Make WordPress Core

Ticket #51289: 51289.diff

File 51289.diff, 6.5 KB (added by audrasjb, 4 years ago)

Docs: Various date/time functions are returning the date/time the content was published, not written

  • src/wp-includes/general-template.php

    diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
    index 01e7fa72d1..7625aa3fef 100644
    a b function the_date_xml() { 
    24542454}
    24552455
    24562456/**
    2457  * Display or Retrieve the date the current post was written (once per date)
     2457 * Display or Retrieve the date the current post was published (once per date)
    24582458 *
    24592459 * Will only output the date if the current post's date is different from the
    24602460 * previous one output.
    function the_date( $format = '', $before = '', $after = '', $echo = true ) { 
    25062506}
    25072507
    25082508/**
    2509  * Retrieve the date on which the post was written.
     2509 * Retrieve the date on which the post was published.
    25102510 *
    25112511 * Unlike the_date() this function will always return the date.
    25122512 * Modify output with the {@see 'get_the_date'} filter.
    function the_date( $format = '', $before = '', $after = '', $echo = true ) { 
    25152515 *
    25162516 * @param string      $format Optional. PHP date format. Defaults to the 'date_format' option.
    25172517 * @param int|WP_Post $post   Optional. Post ID or WP_Post object. Default current post.
    2518  * @return string|false Date the current post was written. False on failure.
     2518 * @return string|false Date the current post was published. False on failure.
    25192519 */
    25202520function get_the_date( $format = '', $post = null ) {
    25212521        $post = get_post( $post );
    function get_the_modified_date( $format = '', $post = null ) { 
    26102610}
    26112611
    26122612/**
    2613  * Display the time at which the post was written.
     2613 * Display the time at which the post was published.
    26142614 *
    26152615 * @since 0.71
    26162616 *
    26172617 * @param string $format Optional. Format to use for retrieving the time the post
    2618  *                       was written. Accepts 'G', 'U', or PHP date format.
     2618 *                       was published. Accepts 'G', 'U', or PHP date format.
    26192619 *                       Defaults to the 'time_format' option.
    26202620 */
    26212621function the_time( $format = '' ) {
    26222622        /**
    2623          * Filters the time a post was written for display.
     2623         * Filters the time a post was published for display.
    26242624         *
    26252625         * @since 0.71
    26262626         *
    26272627         * @param string $get_the_time The formatted time.
    26282628         * @param string $format       Format to use for retrieving the time the post
    2629          *                             was written. Accepts 'G', 'U', or PHP date format.
     2629         *                             was published. Accepts 'G', 'U', or PHP date format.
    26302630         */
    26312631        echo apply_filters( 'the_time', get_the_time( $format ), $format );
    26322632}
    26332633
    26342634/**
    2635  * Retrieve the time at which the post was written.
     2635 * Retrieve the time at which the post was published.
    26362636 *
    26372637 * @since 1.5.0
    26382638 *
    26392639 * @param string      $format Optional. Format to use for retrieving the time the post
    2640  *                            was written. Accepts 'G', 'U', or PHP date format.
     2640 *                            was published. Accepts 'G', 'U', or PHP date format.
    26412641 *                            Defaults to the 'time_format' option.
    26422642 * @param int|WP_Post $post   WP_Post object or ID. Default is global `$post` object.
    26432643 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
    function get_the_time( $format = '', $post = null ) { 
    26552655        $the_time = get_post_time( $_format, false, $post, true );
    26562656
    26572657        /**
    2658          * Filters the time a post was written.
     2658         * Filters the time a post was published.
    26592659         *
    26602660         * @since 1.5.0
    26612661         *
    26622662         * @param string      $the_time The formatted time.
    26632663         * @param string      $format   Format to use for retrieving the time the post
    2664          *                              was written. Accepts 'G', 'U', or PHP date format.
     2664         *                              was published. Accepts 'G', 'U', or PHP date format.
    26652665         * @param int|WP_Post $post     WP_Post object or ID.
    26662666         */
    26672667        return apply_filters( 'get_the_time', $the_time, $format, $post );
    26682668}
    26692669
    26702670/**
    2671  * Retrieve the time at which the post was written.
     2671 * Retrieve the time at which the post was published.
    26722672 *
    26732673 * @since 2.0.0
    26742674 *
    26752675 * @param string      $format    Optional. Format to use for retrieving the time the post
    2676  *                               was written. Accepts 'G', 'U', or PHP date format. Default 'U'.
     2676 *                               was published. Accepts 'G', 'U', or PHP date format. Default 'U'.
    26772677 * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
    26782678 * @param int|WP_Post $post      WP_Post object or ID. Default is global `$post` object.
    26792679 * @param bool        $translate Whether to translate the time string. Default false.
    function get_post_time( $format = 'U', $gmt = false, $post = null, $translate = 
    27122712        }
    27132713
    27142714        /**
    2715          * Filters the localized time a post was written.
     2715         * Filters the localized time a post was published.
    27162716         *
    27172717         * @since 2.6.0
    27182718         *
    27192719         * @param string $time   The formatted time.
    2720          * @param string $format Format to use for retrieving the time the post was written.
     2720         * @param string $format Format to use for retrieving the time the post was published.
    27212721         *                       Accepts 'G', 'U', or PHP date format. Default 'U'.
    27222722         * @param bool   $gmt    Whether to retrieve the GMT time. Default false.
    27232723         */
    function get_post_modified_time( $format = 'U', $gmt = false, $post = null, $tra 
    29142914}
    29152915
    29162916/**
    2917  * Display the weekday on which the post was written.
     2917 * Display the weekday on which the post was published.
    29182918 *
    29192919 * @since 0.71
    29202920 *
    function the_weekday() { 
    29322932        $the_weekday = $wp_locale->get_weekday( get_post_time( 'w', false, $post ) );
    29332933
    29342934        /**
    2935          * Filters the weekday on which the post was written, for display.
     2935         * Filters the weekday on which the post was published, for display.
    29362936         *
    29372937         * @since 0.71
    29382938         *
    function the_weekday() { 
    29422942}
    29432943
    29442944/**
    2945  * Display the weekday on which the post was written.
     2945 * Display the weekday on which the post was published.
    29462946 *
    29472947 * Will only output the weekday if the current post's weekday is different from
    29482948 * the previous one output.
    function the_weekday_date( $before = '', $after = '' ) { 
    29752975        }
    29762976
    29772977        /**
    2978          * Filters the localized date on which the post was written, for display.
     2978         * Filters the localized date on which the post was published, for display.
    29792979         *
    29802980         * @since 0.71
    29812981         *
    2982          * @param string $the_weekday_date The weekday on which the post was written.
     2982         * @param string $the_weekday_date The weekday on which the post was published.
    29832983         * @param string $before           The HTML to output before the date.
    29842984         * @param string $after            The HTML to output after the date.
    29852985         */