WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/23/2019 05:39:36 PM (3 months ago)
Author:
kadamwhite
Message:

REST API: Introduce date_floating property on status endpoint response objects.

Expose a date_floating property on all status objects to permit clients (including the block editor) to make correct decisions about date handling for posts of varying status.

Props mnelson4, earnjam, kadamwhite, jnylen0, nerrad, pento.
See #39953.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r46246 r46252  
    338338        'draft',
    339339        array(
    340             'label'       => _x( 'Draft', 'post status' ),
    341             'protected'   => true,
    342             '_builtin'    => true, /* internal use only. */
     340            'label'         => _x( 'Draft', 'post status' ),
     341            'protected'     => true,
     342            '_builtin'      => true, /* internal use only. */
    343343            /* translators: %s: Number of draft posts. */
    344             'label_count' => _n_noop(
     344            'label_count'   => _n_noop(
    345345                'Draft <span class="count">(%s)</span>',
    346346                'Drafts <span class="count">(%s)</span>'
    347347            ),
     348            'date_floating' => true,
    348349        )
    349350    );
     
    395396        'auto-draft',
    396397        array(
    397             'label'    => 'auto-draft',
    398             'internal' => true,
    399             '_builtin' => true, /* internal use only. */
     398            'label'         => 'auto-draft',
     399            'internal'      => true,
     400            '_builtin'      => true, /* internal use only. */
     401            'date_floating' => true,
    400402        )
    401403    );
     
    10191021 *                                                  e.g. All (12) | Published (9) | My Custom Status (2)
    10201022 *                                                  Default is value of $internal.
     1023 *     @type bool        $date_floating             Whether the post has a floating creation date.
     1024 *                                                  Default to false.
    10211025 * }
    10221026 * @return object
     
    10421046        'show_in_admin_status_list' => null,
    10431047        'show_in_admin_all_list'    => null,
     1048        'date_floating'             => null,
    10441049    );
    10451050    $args     = wp_parse_args( $args, $defaults );
     
    10841089    if ( null === $args->show_in_admin_status_list ) {
    10851090        $args->show_in_admin_status_list = ! $args->internal;
     1091    }
     1092
     1093    if ( null === $args->date_floating ) {
     1094        $args->date_floating = false;
    10861095    }
    10871096
Note: See TracChangeset for help on using the changeset viewer.