Make WordPress Core

Ticket #23207: 23207.diff

File 23207.diff, 1.9 KB (added by theorboman, 10 years ago)

Add an optional $labels paramater to register_post_status()

  • wp-includes/post.php

     
    950950 *     @type bool|string $label                     A descriptive name for the post status marked
    951951 *                                                  for translation. Defaults to value of $post_status.
    952952 *     @type bool|array  $label_count               Descriptive text to use for nooped plurals.
    953  *                                                  Default array of $label, twice
     953 *                                                  Default array of $label, twice.
     954 *     @type array       $labels                    Array of labels to be used in place of the $label
     955 *                                                  and/or $label_count paramaters. This accepts the
     956 *                                                  optional args $name and $count.
     957 *                                                  Default an empty array.
    954958 *     @type bool        $exclude_from_search       Whether to exclude posts with this post status
    955959 *                                                  from search results. Default is value of $internal.
    956960 *     @type bool        $_builtin                  Whether the status is built-in. Core-use only.
     
    983987        $defaults = array(
    984988                'label' => false,
    985989                'label_count' => false,
     990                'labels' => array(),
    986991                'exclude_from_search' => null,
    987992                '_builtin' => false,
    988993                'public' => null,
     
    10271032        if ( null === $args->show_in_admin_status_list )
    10281033                $args->show_in_admin_status_list = !$args->internal;
    10291034
     1035        if ( ! empty( $args->labels ) ) {
     1036
     1037                if ( isset( $args->labels['name'] ) )
     1038                        $args->label = $args->labels['name'];
     1039
     1040                if ( isset( $args->labels['count'] ) )
     1041                        $args->label_count = $args->labels['count'];
     1042
     1043        }
     1044
    10301045        if ( false === $args->label )
    10311046                $args->label = $post_status;
    10321047