WooCommerce : Remove Meta boxes On Product Edit Admin Page.


How to Remove Short Description Metabox,Product Tags Metabox,Product Excerpt Metabox,Product Categories Metabox etc.

There are many meta boxes on product page. some are added by default by WordPress and some are added by WooCommerce plugin. Like product tag, product categories, product gallery etc are added by WooCommerce.

How to disabled product tags in your shop. Or remove short description. Or even, you want to hide other custom “metabox” (e.g. one of those widgets that appear on the Edit Product page).

Removing metaboxes and making the Edit Product page much cleaner is quite easy, using “remove_meta_box” function.

For Removing Product tags or Product short description on product edit page we need the “ID” of the metabox and its position (‘normal’ or ‘side’).

After knowing their id we can simply use “remove_meta_box” function. we can apply “remove_meta_box” function in many hooks but it’s good to use this in “add_meta_boxes_product” hook.

For example:

For removing Product Tag From product page

null

function RemoveProductMetaboxes() {;
  remove_meta_box('tagsdiv-product_tag','product','side'); // For remove product tags
}
add_action('add_meta_boxes_product','RemoveProductMetaboxes', 199 );

For Removing Other Meta boxes

Their are many product meta box by default like:Product Excerpt, Product Custom Fields, Product Slug Metabox, Product Comments Metabox, Product Image Metabox, Product Categories Metabox, Product Tags Metabox, Product Gallary Metabox etc.

function RemoveProductMetaboxes() {
  remove_meta_box('postexcerpt','product','normal');				// Product Excerpt Metabox 
  remove_meta_box('postcustom','product','normal');					// Product Custom Fields Metabox 	 
  remove_meta_box('slugdiv','product','normal');					// Product Slug Metabox  
  remove_meta_box('commentsdiv','product','normal');				// Product Comments Metabox      
  remove_meta_box('postimagediv','product','side');					// Product Image Metabox  
  remove_meta_box('product_catdiv','product','side');				// Product Categories Metabox 	
  remove_meta_box('tagsdiv-product_tag','product','side');  		// Product Tags Metabox     
  remove_meta_box('woocommerce-product-images','product','side'); 	// Product Gallary Metabox
}
add_action('add_meta_boxes_product','RemoveProductMetaboxes', 199 );

For Removing Other Meta boxes For Post Type Page ,Post etc

Their are many default meta box by default like:Excerpt, Custom Fields, Slug Metabox, Comments Metabox, Image Metabox, Categories Metabox, Tags Metabox etc.

function RemoveAllPostTypeMetaboxes() {
// posttype Post meta box
  remove_meta_box('categorydiv','post','normal' );       // Categories Metabox 
  remove_meta_box('submitdiv','post','normal' );         // Categories Metabox 
  remove_meta_box('postcustom','post','normal' );        // Custom Fields Metabox 
  remove_meta_box('commentsdiv','post','normal' );       // Comments Metabox 
  remove_meta_box('trackbacksdiv','post','normal' );     // Trackback Metabox
  remove_meta_box('authordiv','post','normal' );         // Author Metabox 
  remove_meta_box('postexcerpt','post','normal' );       // Excerpt Metabox 
  remove_meta_box('revisionsdiv','post','normal' );      // Revisions Metabox 
  remove_meta_box('slugdiv','post','normal' );           // Slug Metabox 
  remove_meta_box('formatdiv','post','normal' );         // Formats Metabox 
  remove_meta_box('postimagediv','post','normal' );      // Featured Image Metabox 
  remove_meta_box('tagsdiv-post_tag','post','normal' );  // Tags Metabox 
  remove_meta_box('commentstatusdiv','post','normal' );  // Comments Status Metabox 

// posttype Page meta box
  remove_meta_box('postcustom','page','normal' );        // Custom Fields Metabox 
  remove_meta_box('commentstatusdiv','page','normal' );  // Comments Metabox 
  remove_meta_box('trackbacksdiv','page','normal' );     // Talkback Metabox 
  remove_meta_box('authordiv','page','normal' );         // Author Metabox 
  remove_meta_box('postexcerpt','page','normal' );       // Excerpt Metabox 
  remove_meta_box('slugdiv','page','normal' );           // Slug Metabox 
}
add_action('admin_menu','RemoveAllPostTypeMetaboxes');
, ,

Leave a Reply

Your email address will not be published. Required fields are marked *