I want to remove some meta boxes like:
Product Short description, Reviews
I can remove default metaboxes:
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 cant remove "postexcerpt" - Product Short description and "commentsdiv" - Reviews, because they are loaded in add_filter - add_meta_boxes
Is there any other hook after this to apply my script ? Or maybe there is another method ?
Thank you!
WooCommerce removes the default postexcerpts and replaces it with its own version (the 'Product Short Description' meta box) (class-wc-admin-meta-boxes.php)
So like user1139767 said, you have to alter the priority. However when I tried 11, it didn't work, neither did 20. But 50 seems to do the trick:
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 );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With