apply_filters( ‘default_hidden_meta_boxes’, string[] $hidden, WP_Screen $screen )

Filters the default list of hidden meta boxes.


An array of IDs of meta boxes hidden by default.
WP_Screen object of the current screen.


$hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen );



User Contributed Notes

  1. Skip to note 2 content

    This filter is used to hide metabox by default, an admin user can then select the ‘Screen Options’ tab in the top right hand corner of the post edit screen and they will see the designated ‘hidden’ metaboxes checked in the list of options,

    function hide_meta_box($hidden, $screen) {
        //make sure we are dealing with the correct screen
        if ( ('post' == $screen->base) && ('my-custom-post_type' == $screen->id) ){
          //lets hide everything
          $hidden = array('postexcerpt','slugdiv','postcustom','trackbacksdiv', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
          $hidden[] ='my_custom_meta_box';//for custom meta box, enter the id used in the add_meta_box() function.
        return $hidden;

You must log in before being able to contribute a note or feedback.