Make WordPress Core

Changeset 59691


Ignore:
Timestamp:
01/22/2025 11:29:25 PM (3 weeks ago)
Author:
audrasjb
Message:

Docs: Clarify the purpose of post date/time functions.

This changeset clarifies the purpose of these functions and make the documentation more accurate and flexible. Instead of referring to the "date the post was written," the functions and filter descriptions now refer to the "date of the post." This change accommodates scenarios where the displayed date might not strictly correspond to the writing date (e.g. scheduled posts, backdated posts, or content where the "date" represents something other than creation).

Props casiepa, audrasjb, SergeyBiryukov, Rarst, helen, azouamauriac, pbearne.
Fixes #51289.

File:
1 edited

Legend:

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

    r59606 r59691  
    25182518
    25192519/**
    2520  * Displays or retrieves the date the current post was written (once per date)
     2520 * Displays or retrieves the date of the post (once per date).
    25212521 *
    25222522 * Will only output the date if the current post's date is different from the
     
    25512551
    25522552    /**
    2553      * Filters the date a post was published for display.
     2553     * Filters the date of the post, for display.
    25542554     *
    25552555     * @since 0.71
     
    25702570
    25712571/**
    2572  * Retrieves the date on which the post was written.
     2572 * Retrieves the date of the post.
    25732573 *
    25742574 * Unlike the_date() this function will always return the date.
     
    25932593
    25942594    /**
    2595      * Filters the date a post was published.
     2595     * Filters the date of the post.
    25962596     *
    25972597     * @since 3.0.0
     
    26192619
    26202620    /**
    2621      * Filters the date a post was last modified for display.
     2621     * Filters the date a post was last modified, for display.
    26222622     *
    26232623     * @since 2.1.0
     
    26732673
    26742674/**
    2675  * Displays the time at which the post was written.
     2675 * Displays the date of the post.
    26762676 *
    26772677 * @since 0.71
     
    26832683function the_time( $format = '' ) {
    26842684    /**
    2685      * Filters the time a post was written for display.
     2685     * Filters the date of the post, for display.
    26862686     *
    26872687     * @since 0.71
     
    26952695
    26962696/**
    2697  * Retrieves the time at which the post was written.
     2697 * Retrieves the date of the post.
    26982698 *
    26992699 * @since 1.5.0
     
    27182718
    27192719    /**
    2720      * Filters the time a post was written.
     2720     * Filters the date of the post.
    27212721     *
    27222722     * @since 1.5.0
     
    27312731
    27322732/**
    2733  * Retrieves the time at which the post was written.
     2733 * Retrieves the localized date of the post.
    27342734 *
    27352735 * @since 2.0.0
     
    27752775
    27762776    /**
    2777      * Filters the localized time a post was written.
     2777     * Filters the localized date of the post.
    27782778     *
    27792779     * @since 2.6.0
    27802780     *
    27812781     * @param string|int $time   Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
    2782      * @param string     $format Format to use for retrieving the time the post was written.
     2782     * @param string     $format Format to use for retrieving the date of the post.
    27832783     *                           Accepts 'G', 'U', or PHP date format.
    27842784     * @param bool       $gmt    Whether to retrieve the GMT time.
     
    29772977
    29782978/**
    2979  * Displays the weekday on which the post was written.
     2979 * Displays the weekday for the post.
    29802980 *
    29812981 * @since 0.71
     
    29952995
    29962996    /**
    2997      * Filters the weekday on which the post was written, for display.
     2997     * Filters the weekday of the post, for display.
    29982998     *
    29992999     * @since 0.71
     
    30053005
    30063006/**
    3007  * Displays the weekday on which the post was written.
     3007 * Displays the localized weekday date for the post
    30083008 *
    30093009 * Will only output the weekday if the current post's weekday is different from
     
    30383038
    30393039    /**
    3040      * Filters the localized date on which the post was written, for display.
     3040     * Filters the localized weekday date of the post, for display.
    30413041     *
    30423042     * @since 0.71
     
    43524352function the_search_query() {
    43534353    /**
    4354      * Filters the contents of the search query variable for display.
     4354     * Filters the contents of the search query variable, for display.
    43554355     *
    43564356     * @since 2.3.0
     
    49854985function the_generator( $type ) {
    49864986    /**
    4987      * Filters the output of the XHTML generator tag for display.
     4987     * Filters the output of the XHTML generator tag, for display.
    49884988     *
    49894989     * @since 2.5.0
Note: See TracChangeset for help on using the changeset viewer.