WordPress.org

Make WordPress Core

Changeset 19049


Ignore:
Timestamp:
10/23/2011 07:22:27 PM (9 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/screen.php

    r19014 r19049  
    9191    $hidden = get_user_option( "metaboxhidden_{$screen->id}" );
    9292
     93    $use_defaults = ! is_array( $hidden );
     94
    9395    // Hide slug boxes by default
    94     if ( !is_array( $hidden ) ) {
    95         if ( 'post' == $screen->base || 'page' == $screen->base )
    96             $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
    97         else
    98             $hidden = array( 'slugdiv' );
    99         $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);
    100     }
    101 
    102     return $hidden;
     96    if ( $use_defaults ) {
     97        $hidden = array();
     98        if ( 'post' == $screen->base ) {
     99            if ( 'post' == $screen->post_type || 'page' == $screen->post_type )
     100                $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
     101            else
     102                $hidden = array( 'slugdiv' );
     103        }
     104        $hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen );
     105    }
     106
     107    return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults );
    103108}
    104109
Note: See TracChangeset for help on using the changeset viewer.