Support

Account

Home Forums Backend Issues (wp-admin) Remove a metabox from edit page

Solved

Remove a metabox from edit page

  • Does anyone have sample code for removing a metabox from the edit page?

    I created a custom taxonomy for my CPT and then embedded that taxonomy into the ACF form, so I want to remove the associated metabox from the edit page.

    I can’t find any sample code for accomplishing that.

    Thanks!

  • Found it!

    /* Remove Custom Taxonomy Meta Boxes */
    function dads_remove_tax_meta() {
    	remove_meta_box( 'ad-zonesdiv', 'post', 'side' );
    }
    add_action( 'admin_menu' , 'dads_remove_tax_meta' );
  • Correction:

    /* Remove Custom Taxonomy Meta Boxes */
    function dads_remove_tax_meta() {
    	remove_meta_box( 'ad-zonesdiv', 'digital-ads', 'side' );
    }
    
    add_action( 'add_meta_boxes' , 'dads_remove_tax_meta' );

    “add_meta_boxes” is the better action to capture and post removes it from all post types while I can specify the post type directly.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.