Make WordPress Core


Ignore:
Timestamp:
08/31/2020 06:58:04 PM (5 years ago)
Author:
desrosj
Message:

Date/Time: In get_the_date() and related functions, pass the original, unmodified $format value to the filters.

Additionally, simplify the $format argument checks for consistency with similar checks in get_the_modified_date() and get_the_modified_time().

Follow-up to [48912].

Props Rarst.
Merges [48918] to the 5.5 branch.
See #51184.

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/src/wp-includes/comment-template.php

    r48921 r48922  
    553553    $comment = get_comment( $comment_ID );
    554554
    555     if ( ! is_string( $format ) || '' === $format ) {
    556         $format = get_option( 'date_format' );
    557     }
    558 
    559     $date = mysql2date( $format, $comment->comment_date );
     555    $_format = ! empty( $format ) ? $format : get_option( 'date_format' );
     556
     557    $date = mysql2date( $_format, $comment->comment_date );
    560558
    561559    /**
     
    10471045    $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
    10481046
    1049     if ( ! is_string( $format ) || '' === $format ) {
    1050         $format = get_option( 'time_format' );
    1051     }
    1052 
    1053     $date = mysql2date( $format, $comment_date, $translate );
     1047    $_format = ! empty( $format ) ? $format : get_option( 'time_format' );
     1048
     1049    $date = mysql2date( $_format, $comment_date, $translate );
    10541050
    10551051    /**
Note: See TracChangeset for help on using the changeset viewer.