Make WordPress Core

Changeset 12994


Ignore:
Timestamp:
02/06/2010 05:46:00 PM (17 years ago)
Author:
ryan
Message:

Add more visibility args to post status registration. see #9674

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r12993 r12994  
    233233$status_links[] = "<li><a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
    234234
    235 foreach ( get_post_stati(array(), 'objects') as $status ) {
     235foreach ( get_post_stati(array('show_in_admin_edit' => true), 'objects') as $status ) {
    236236        $class = '';
    237237
  • trunk/wp-includes/post.php

    r12993 r12994  
    6262
    6363        register_post_status( 'publish', array( 'label' => _x('Published', 'post'),
    64                                                                                         'exclude_from_search' => false,
     64                                                                                        'public' => true,
    6565                                                                                        '_builtin' => true,
    6666                                                                                        'label_count' => _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>')
    … …  
    6868
    6969        register_post_status( 'future', array(  'label' => _x('Scheduled', 'post'),
    70                                                                                         'exclude_from_search' => false,
     70                                                                                        'public' => true,
    7171                                                                                        '_builtin' => true,
    7272                                                                                        'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>')
    … …  
    7474
    7575        register_post_status( 'draft', array(   'label' => _x('Draft', 'post'),
    76                                                                                         'exclude_from_search' => false,
     76                                                                                        'public' => true,
    7777                                                                                        '_builtin' => true,
    7878                                                                                        'label_count' => _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')
    … …  
    8080
    8181        register_post_status( 'private', array( 'label' => _x('Private', 'post'),
    82                                                                                         'exclude_from_search' => false,
     82                                                                                        'public' => true,
    8383                                                                                        '_builtin' => true,
    8484                                                                                        'label_count' => _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')
    … …  
    8686
    8787        register_post_status( 'trash', array(   'label' => _x('Trash', 'post'),
    88                                                                                         'exclude_from_search' => false,
     88                                                                                        'public' => true,
    8989                                                                                        '_builtin' => true,
    9090                                                                                        'label_count' => _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')
    … …  
    9292
    9393        register_post_status( 'auto-draft', array(      'label' => _x('Auto-Draft', 'post'),
    94                                                                                         'exclude_from_search' => true,
     94                                                                                        'public' => false,
    9595                                                                                        '_builtin' => true,
    9696                                                                                        'label_count' => _n_noop('Auto-Draft <span class="count">(%s)</span>', 'Auto-Drafts <span class="count">(%s)</span>')
    … …  
    522522
    523523        // Args prefixed with an underscore are reserved for internal use.
    524         $defaults = array('label' => false, 'label_count' => false, 'exclude_from_search' => true, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false);
     524        $defaults = array('label' => false, 'label_count' => false, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'publicly_queryable' => null, 'show_in_admin_edit' => null);
    525525        $args = wp_parse_args($args, $defaults);
    526526        $args = (object) $args;
    … …  
    529529        $args->name = $post_status;
    530530
     531        // If not set, default to the setting for public.
     532        if ( null === $args->publicly_queryable )
     533                $args->publicly_queryable = $args->public;
     534
     535        // If not set, default to true if not public, false if public.
     536        if ( null === $args->exclude_from_search )
     537                $args->exclude_from_search = !$args->public;
     538
     539        // If not set, default to the setting for public.
     540        if ( null === $args->show_in_admin_edit )
     541                $args->show_in_admin_edit = $args->public;
     542
    531543        if ( false === $args->label )
    532544                $args->label = $post_status;
    … …  
    534546        if ( false === $args->label_count )
    535547                $args->label_count = $args->label;
    536 
    537         if ( !$args->_builtin && $args->public )
    538                 $args->_show = true;
    539548
    540549        $wp_post_statuses[$post_status] = $args;
Note: See TracChangeset for help on using the changeset viewer.