Woocommerce removes meta boxes

I want to delete some meta fields, for example:

Product Brief, Reviews

I can remove the default metabox:

function remove_metaboxes() {
     remove_meta_box( 'postcustom' , 'product' , 'normal' );
     remove_meta_box( 'postexcerpt' , 'product' , 'normal' );
     remove_meta_box( 'commentsdiv' , 'product' , 'normal' );
     remove_meta_box( 'tagsdiv-product_tag' , 'product' , 'normal' );
}
add_action( 'admin_menu' , 'remove_metaboxes' );

But I can’t remove the "postexcerpt" - Product Brief and "commentsdiv" - reviews because they are uploaded to add_filter - add_meta_boxes

Is there another hook after this to apply my script? Or maybe there is another method?

Thank!

+3
source share
4 answers
function remove_my_metaboxes() {
remove_meta_box( 'categorydiv','post','normal' );       // Categories Metabox 
remove_meta_box( 'submitdiv','post','normal' );         // Categories Metabox 
remove_meta_box( 'postcustom','page','normal' );        // Custom Fields Metabox 
remove_meta_box( 'postcustom','post','normal' );        // Custom Fields Metabox 
remove_meta_box( 'commentstatusdiv','page','normal' );  // Comments Metabox 
remove_meta_box( 'commentsdiv','post','normal' );       // Comments Metabox 
remove_meta_box( 'trackbacksdiv','page','normal' );     // Talkback Metabox 
remove_meta_box( 'trackbacksdiv','post','normal' );     // Trackback Metabox
remove_meta_box( 'authordiv','page','normal' );         // Author Metabox 
remove_meta_box( 'authordiv','post','normal' );         // Author Metabox 
remove_meta_box( 'postexcerpt','post','normal' );       // Excerpt Metabox 
remove_meta_box( 'postexcerpt','page','normal' );       // Excerpt Metabox 
remove_meta_box( 'revisionsdiv','post','normal' );      // Revisions Metabox 
remove_meta_box( 'slugdiv','page','normal' );           // Slug 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
}
add_action('admin_menu','remove_my_metaboxes');

just comment out "remove_meta_box" what you want to display on your page / posts.

We can also remove meta fields by changing your own message type name in the remove_meta_box function instead of "post" or "page".

+1
source

WooCommerce postexcerpts (- " " ) (class-wc-admin-meta-boxes.php)

user1139767 , . , 11, , 20. 50, , :

function remove_metaboxes() {
     remove_meta_box( 'postcustom' , 'product' , 'normal' );
     remove_meta_box( 'postexcerpt' , 'product' , 'normal' );
     remove_meta_box( 'commentsdiv' , 'product' , 'normal' );
     remove_meta_box( 'tagsdiv-product_tag' , 'product' , 'normal' );
}
add_action( 'add_meta_boxes' , 'remove_metaboxes', 50 );
+3

remove_meta_box ('tagsdiv-product_tag', 'product', 'normal');

, :

remove_meta_box( 'tagsdiv-product_tag','product','side' );

" "

+2

add_action:

add_action( 'add_meta_boxes' , 'remove_metaboxes', 11 );

10, 11, 10.

0

All Articles