Make WordPress Core


Ignore:
Timestamp:
12/17/2019 08:52:44 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: Ensure that get_feed_build_date() correctly handles a modified post object with invalid date.

  • Clarify in the documentation that the function returns false on failure.
  • Consistently pass the return value through the get_feed_build_date filter.

Props Rarst, dd32, azaozz, tellyworth.
Merges [46974] and [46973] to the 5.3 branch.
Fixes #48957.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-includes/post.php

    r46975 r46977  
    63876387 *                          Default 'server'.
    63886388 * @param string $post_type Optional. The post type to check. Default 'any'.
    6389  * @return string The date of the last post.
     6389 * @return string The date of the last post, or false on failure.
    63906390 */
    63916391function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
     
    63956395     * @since 2.3.0
    63966396     *
    6397      * @param string $date     Date the last post was published.
    6398      * @param string $timezone Location to use for getting the post published date.
    6399      *                         See get_lastpostdate() for accepted `$timezone` values.
     6397     * @param string|false $date     Date the last post was published. False on failure.
     6398     * @param string       $timezone Location to use for getting the post published date.
     6399     *                               See get_lastpostdate() for accepted `$timezone` values.
    64006400     */
    64016401    return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone );
     
    64166416 *                          Default 'server'.
    64176417 * @param string $post_type Optional. The post type to check. Default 'any'.
    6418  * @return string The timestamp in 'Y-m-d H:i:s' format.
     6418 * @return string The timestamp in 'Y-m-d H:i:s' format, or false on failure.
    64196419 */
    64206420function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
     
    64476447     * @since 2.3.0
    64486448     *
    6449      * @param string $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format.
    6450      * @param string $timezone         Location to use for getting the post modified date.
    6451      *                                 See get_lastpostdate() for accepted `$timezone` values.
     6449     * @param string|false $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format.
     6450     *                                       False on failure.
     6451     * @param string       $timezone         Location to use for getting the post modified date.
     6452     *                                       See get_lastpostdate() for accepted `$timezone` values.
    64526453     */
    64536454    return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
     
    64676468 * @param string $field     Post field to check. Accepts 'date' or 'modified'.
    64686469 * @param string $post_type Optional. The post type to check. Default 'any'.
    6469  * @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on error.
     6470 * @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on failure.
    64706471 */
    64716472function _get_last_post_time( $timezone, $field, $post_type = 'any' ) {
Note: See TracChangeset for help on using the changeset viewer.