WordPress.org

Make WordPress Core

Ticket #18972: 18972.diff

File 18972.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..fc3a372 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                '_edit_link' => 'post.php?post=%d',
     668                'public' => null,
     669                'internal' => null,
     670                'protected' => null,
     671                'private' => null,
     672                'show_in_admin_all' => null,
     673                'publicly_queryable' => null,
     674                'show_in_admin_status_list' => null,
     675                'show_in_admin_all_list' => null,
     676                'single_view_cap' => null
     677        );
     678
     679        $args = (object) wp_parse_args($args, $defaults);
    665680
    666681        $post_status = sanitize_key($post_status);
    667682        $args->name = $post_status;
    function register_post_status($post_status, $args = array()) { 
    669684        if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
    670685                $args->internal = true;
    671686
    672         if ( null === $args->public  )
     687        if ( null === $args->public )
    673688                $args->public = false;
    674689
    675         if ( null === $args->private  )
     690        if ( null === $args->private )
    676691                $args->private = false;
    677692
    678         if ( null === $args->protected  )
     693        if ( null === $args->protected )
    679694                $args->protected = false;
    680695
    681         if ( null === $args->internal  )
     696        if ( null === $args->internal )
    682697                $args->internal = false;
    683698
    684699        if ( null === $args->publicly_queryable )
    function register_post_type($post_type, $args = array()) { 
    10401055        }
    10411056
    10421057        do_action( 'registered_post_type', $post_type, $args );
    1043        
     1058
    10441059        return $args;
    10451060}
    10461061
    add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' ); 
    53085323
    53095324/**
    53105325 * 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  * 
     5326 *
    53125327 * @access private
    53135328 * @param string $new_status
    53145329 * @param string $old_status