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

Filters the default list of hidden meta boxes.


Parameters

$hidden string[]
An array of IDs of meta boxes hidden by default.
$screen WP_Screen
WP_Screen object of the current screen.

Top ↑

Source

File: wp-admin/includes/screen.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Aurovrata Venet

    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,

    add_filter('default_hidden_meta_boxes','hide_meta_box',10,2);
    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.