WordPress.org

Make WordPress Core

Ticket #18972: 18972.2.diff

File 18972.2.diff, 2.8 KB (added by scribu, 7 years ago)
  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index c4ce1af..592da02 100644
    function get_page_statuses( ) { 
    626626}
    627627
    628628/**
    629  * Register a post type. Do not use before init.
     629 * Register a post status. Do not use before init.
    630630 *
    631631 * A simple function for creating or modifying a post status based on the
    632632 * parameters given. The function will accept an array (second optional
    function register_post_status($post_status, $args = array()) { 
    659659                $wp_post_statuses = array();
    660660
    661661        // Args prefixed with an underscore are reserved for internal use.
    662         $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' => null, 'internal' => null, 'protected' => null, 'private' => null, 'show_in_admin_all' => null, 'publicly_queryable' => null, 'show_in_admin_status_list' => null, 'show_in_admin_all_list' => null, 'single_view_cap' => null);
    663         $args = wp_parse_args($args, $defaults);
    664         $args = (object) $args;
     662        $defaults = array(
     663                'label' => false,
     664                'label_count' => false,
     665                'exclude_from_search' => null,
     666                '_builtin' => false,
     667                'public' => null,
     668                'internal' => null,
     669                'protected' => null,
     670                'private' => null,
     671                'show_in_admin_all' => null,
     672                'publicly_queryable' => null,
     673                'show_in_admin_status_list' => null,
     674                'show_in_admin_all_list' => null,
     675                'single_view_cap' => null
     676        );
     677
     678        $args = (object) wp_parse_args($args, $defaults);
    665679
    666680        $post_status = sanitize_key($post_status);
    667681        $args->name = $post_status;
    function register_post_status($post_status, $args = array()) { 
    669683        if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
    670684                $args->internal = true;
    671685
    672         if ( null === $args->public  )
     686        if ( null === $args->public )
    673687                $args->public = false;
    674688
    675         if ( null === $args->private  )
     689        if ( null === $args->private )
    676690                $args->private = false;
    677691
    678         if ( null === $args->protected  )
     692        if ( null === $args->protected )
    679693                $args->protected = false;
    680694
    681         if ( null === $args->internal  )
     695        if ( null === $args->internal )
    682696                $args->internal = false;
    683697
    684698        if ( null === $args->publicly_queryable )
    function register_post_type($post_type, $args = array()) { 
    10401054        }
    10411055
    10421056        do_action( 'registered_post_type', $post_type, $args );
    1043        
     1057
    10441058        return $args;
    10451059}
    10461060
    add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' ); 
    53085322
    53095323/**
    53105324 * Update the custom taxonomies' term counts when a post's status is changed. For example, default posts term counts (for custom taxonomies) don't include private / draft posts.
    5311  * 
     5325 *
    53125326 * @access private
    53135327 * @param string $new_status
    53145328 * @param string $old_status