-
Hello, Is it possible to hide metabox on specific pages? Specifically, I want to hide metaboxes on woocommerce default pages (Shop, cart, checkout, my account) and blog page. Can you give me an idea how can I do it?
Thanks in advance.Posted 4 years ago # -
Hi,
Hmm, actually it is possible with a little custom code. for eg. I can give your this idea:
function hide_metabox_in_woo_pages() { global $post, $post_type; if( class_exists( 'WooCommerce' ) && is_object( $post ) && $post_type === 'page' ) { $exclude = array(); $exclude[] = get_option( 'woocommerce_shop_page_id' ); $exclude[] = get_option( 'woocommerce_cart_page_id' ); $exclude[] = get_option( 'woocommerce_checkout_page_id' ); $exclude[] = get_option( 'woocommerce_myaccount_page_id' ); if( in_array( $post->ID, $exclude ) ) { echo '<style type="text/css">'; echo '#YOUR_METABOX_UNIQUE_ID{ display: none !important; }'; echo '</style>'; } } } add_action( 'admin_head', 'hide_metabox_in_woo_pages' );
CopyCopied!I am not sure it is works 100% but you can get the idea
Regards, Codestar
Posted 4 years ago # -
You are awesome.. your codes work fine. Thank you
Posted 4 years ago # -
You're welcome
Posted 4 years ago # -
Can I hide meta box blog post page?
Posted 1 year ago # -
Hi @TwinkleTheme,
Unfortunately, there is no option for this. You should write custom js for that.
Regards, Codestar
Posted 1 year ago #