WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] remove_meta_box not working for some boxes (4 posts)

  1. conualfy
    Member
    Posted 3 years ago #

    I'm using Magic Fields for a site and I do not need any of the original text fields in WP (not even the post textarea) and for normal users I want to disable the All in one SEO box also, but remove-meta-boxes seems not to work for them.

    remove_meta_box('postdivrich','post','normal');
    remove_meta_box('aiosp','post','normal');
    These are not working for those boxes.

    Do you know how I can remove them?

    Thanks!

  2. David Sader
    Member
    Posted 3 years ago #

    The SEO plugin meta boxes are added to the admin at one function at the 'admin_menu' action:

    add_action('admin_menu', 'aioseop_meta_box_add');

    You can remove all the boxes added at that action with

    remove_action('admin_menu', 'aioseop_meta_box_add');

  3. conualfy
    Member
    Posted 3 years ago #

    @David Thanks a lot, it works!

    Do you know how to remove the post textarea, the (it shows in post.php, post-new.php)?

    As I use Magic Fields, I record all the information in custom fields and I do not need these fields/boxes:
    Media Buttons (all) (#media-buttons)
    Word count (#wp-word-count)
    Post Slug (#slugdiv,#edit-slug-box)
    HTML Editor Button (#editor-toolbar #edButtonHTML, #quicktags)
    Post Thumbnail (#postimagediv)

  4. David Sader
    Member
    Posted 3 years ago #

    add_action( 'admin_head', 'ds_hide_stuff'  );
    function ds_hide_stuff() {
    	global $post_type;
    		remove_action( 'media_buttons', 'media_buttons' );
    		remove_meta_box('slugdiv', $post_type, 'normal');
    		remove_meta_box('postimagediv', $post_type, 'side');
    
    		$ds_hide_postdiv = "<style type=\"text/css\"> #postdiv, #postdivrich { display: none; }</style>";
    		print($ds_hide_postdiv);
    }

Topic Closed

This topic has been closed to new replies.

About this Topic