From d0f8826c0bca74603d156354591152c588255a81 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 6 Feb 2010 17:46:00 +0000 Subject: [PATCH] Add more visibility args to post status registration. see #9674 git-svn-id: http://svn.automattic.com/wordpress/trunk@12994 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit.php | 2 +- wp-includes/post.php | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/wp-admin/edit.php b/wp-admin/edit.php index fe08176713..14b008fb80 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -232,7 +232,7 @@ $total_posts = array_sum( (array) $num_posts ) - $num_posts->trash; $class = empty($class) && empty($_GET['post_status']) ? ' class="current"' : ''; $status_links[] = "
  • " . sprintf( _nx( 'All (%s)', 'All (%s)', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . ''; -foreach ( get_post_stati(array(), 'objects') as $status ) { +foreach ( get_post_stati(array('show_in_admin_edit' => true), 'objects') as $status ) { $class = ''; $status_name = $status->name; diff --git a/wp-includes/post.php b/wp-includes/post.php index a554532dd4..82d8cdc87c 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -61,37 +61,37 @@ function create_initial_post_types() { ) ); register_post_status( 'publish', array( 'label' => _x('Published', 'post'), - 'exclude_from_search' => false, + 'public' => true, '_builtin' => true, 'label_count' => _n_noop('Published (%s)', 'Published (%s)') ) ); register_post_status( 'future', array( 'label' => _x('Scheduled', 'post'), - 'exclude_from_search' => false, + 'public' => true, '_builtin' => true, 'label_count' => _n_noop('Scheduled (%s)', 'Scheduled (%s)') ) ); register_post_status( 'draft', array( 'label' => _x('Draft', 'post'), - 'exclude_from_search' => false, + 'public' => true, '_builtin' => true, 'label_count' => _n_noop('Draft (%s)', 'Drafts (%s)') ) ); register_post_status( 'private', array( 'label' => _x('Private', 'post'), - 'exclude_from_search' => false, + 'public' => true, '_builtin' => true, 'label_count' => _n_noop('Private (%s)', 'Private (%s)') ) ); register_post_status( 'trash', array( 'label' => _x('Trash', 'post'), - 'exclude_from_search' => false, + 'public' => true, '_builtin' => true, 'label_count' => _n_noop('Trash (%s)', 'Trash (%s)') ) ); register_post_status( 'auto-draft', array( 'label' => _x('Auto-Draft', 'post'), - 'exclude_from_search' => true, + 'public' => false, '_builtin' => true, 'label_count' => _n_noop('Auto-Draft (%s)', 'Auto-Drafts (%s)') ) ); @@ -521,22 +521,31 @@ function register_post_status($post_status, $args = array()) { $wp_post_statuses = array(); // Args prefixed with an underscore are reserved for internal use. - $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); + $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); $args = wp_parse_args($args, $defaults); $args = (object) $args; $post_status = sanitize_user($post_status, true); $args->name = $post_status; + // If not set, default to the setting for public. + if ( null === $args->publicly_queryable ) + $args->publicly_queryable = $args->public; + + // If not set, default to true if not public, false if public. + if ( null === $args->exclude_from_search ) + $args->exclude_from_search = !$args->public; + + // If not set, default to the setting for public. + if ( null === $args->show_in_admin_edit ) + $args->show_in_admin_edit = $args->public; + if ( false === $args->label ) $args->label = $post_status; if ( false === $args->label_count ) $args->label_count = $args->label; - if ( !$args->_builtin && $args->public ) - $args->_show = true; - $wp_post_statuses[$post_status] = $args; return $args;