• Hi,

    I am trying to remove some meta boxes put in place by a theme I am using, but no matter what I try, they just will not be removed.

    Using the following:

    function remove_meta_boxes() {
    
    	remove_meta_box( 'avhec_catgroupdiv', 'post', 'side' ); // Category Groups meta box [Plugin or BuddyPress]
    	remove_meta_box( 'tagsdiv-post_tag', 'post', 'side' ); // Tags [WordPress default]
    
    	remove_meta_box( 'content-options', 'post', 'side' ); // Content Options [Salutation]
    	remove_meta_box( 'design-options', 'post', 'side' ); // Design Options [Salutation]
    	remove_meta_box( 'layout-options', 'post', 'side' ); // Layout Options [Salutation]
    
    	remove_meta_box( 'media', 'post', 'side' ); // Media [Salutation]
    
    	remove_meta_box( 'wdfb_opengraph_editor', 'post', 'side' ); // OPenGraph [part of the FB Plugin]
    }
    
    add_action('admin_menu', 'remove_meta_boxes');

    The first two work and the meta boxes are removed, but the last four do not work.

    Can anyone see why this is the case?

    Additionally, I would like to apply all of these rules to the author role and below only – would adding the following work for this?

    if ( !current_user_can( 'edit_published_posts' ) ) { // if user is below Author level

    Thank you to anyone who can offer some assistance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am also running into a similar issue using the same methods. Some boxes are being removed, others are not.

    Thanks.

    Of course, I’ve been searching for 2 hours and as soon as I make a post, I find the answer. Some meta boxes were added using the admin_head action, rather than the admin_menu action.

    This may be the same for you, JamesICT.

    I simply added the following line at the bottom of the snippet:

    add_action( 'admin_head', 'my_remove_meta_boxes' );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Removing meta boxes’ is closed to new replies.