WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/26/2016 11:29:13 AM (4 years ago)
Author:
peterwilsoncc
Message:

Posts: Fix back-compat for filters in get the modified time and date functions after [37738].

When no valid post exists for get_the_modified_time or get_the_modified_date calls, the result (false) is passed through the functions respective filters to maintain back-compat.

Introduces unit tests to ensure filters are applied and for the get_the_modified_date function.

Fixes #37059.

File:
1 edited

Legend:

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

    r37753 r37866  
    22662266
    22672267    if ( ! $post ) {
    2268         return false;
    2269     }
    2270 
    2271     if ( empty( $d ) ) {
     2268        // For backward compatibility, failures go through the filter below.
     2269        $the_time = false;
     2270    } elseif ( empty( $d ) ) {
    22722271        $the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true );
    22732272    } else {
     
    24222421
    24232422    if ( ! $post ) {
    2424         return false;
    2425     }
    2426 
    2427     if ( empty( $d ) ) {
     2423        // For backward compatibility, failures go through the filter below.
     2424        $the_time = false;
     2425    } elseif ( empty( $d ) ) {
    24282426        $the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
    24292427    } else {
Note: See TracChangeset for help on using the changeset viewer.