One of the site I do not need the product short description meta box. Therefore I am completely removing this meta box from product add/edit screen. Here is the simple PHP snippets which I added to functions.php file of my theme.
1 2 3 4 5 6 7 8 9 10 11 |
<?php //* Do not include this line /** * Removing the short description meta box */ function paulc_remove_product_short_description_box() { if ( current_user_can( 'edit_post' ) ) { remove_meta_box( 'postexcerpt', 'product', 'normal' ); } } add_action( 'add_meta_boxes', 'paulc_remove_product_short_description_box', 50 ); |
In WooCommerce product short description meta box registered by add_meta_boxes hook with priority 30. So I removing the meta boxes with higher priority like 50 . remove_meta_box() function is removing the registered meta box. It is accepting three parameters:
- id: Value of the id attribute of the HTML element to remove.
- page: Type of the screen to remove the meta box from, such as: post, page, custom post type etc.
- context: The context within the screen where the boxes should display. It should be ‘normal’, ‘advanced’, or ‘side’.
Leave a Reply