Rework get_hidden_meta_boxes() to leverage a full WP_Screen object. Prevents custom post types from having their explicity supported meta boxes being hidden by default. see #18958.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-10-23 19:22:27 +00:00
parent d01f93226d
commit c62a9fe508
1 changed files with 12 additions and 7 deletions

View File

@ -90,16 +90,21 @@ function get_hidden_meta_boxes( $screen ) {
$hidden = get_user_option( "metaboxhidden_{$screen->id}" );
$use_defaults = ! is_array( $hidden );
// Hide slug boxes by default
if ( !is_array( $hidden ) ) {
if ( 'post' == $screen->base || 'page' == $screen->base )
$hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
else
$hidden = array( 'slugdiv' );
$hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);
if ( $use_defaults ) {
$hidden = array();
if ( 'post' == $screen->base ) {
if ( 'post' == $screen->post_type || 'page' == $screen->post_type )
$hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
else
$hidden = array( 'slugdiv' );
}
$hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen );
}
return $hidden;
return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults );
}
/**