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.
See #51184.

git-svn-id: https://develop.svn.wordpress.org/trunk@48918 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-08-31 18:28:42 +00:00
parent 390f84b715
commit d33fa375f6
2 changed files with 14 additions and 22 deletions

View File

@@ -552,11 +552,9 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
function get_comment_date( $format = '', $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
if ( ! is_string( $format ) || '' === $format ) {
$format = get_option( 'date_format' );
}
$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
$date = mysql2date( $format, $comment->comment_date );
$date = mysql2date( $_format, $comment->comment_date );
/**
* Filters the returned comment date.
@@ -1046,11 +1044,9 @@ function get_comment_time( $format = '', $gmt = false, $translate = true ) {
$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
if ( ! is_string( $format ) || '' === $format ) {
$format = get_option( 'time_format' );
}
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
$date = mysql2date( $format, $comment_date, $translate );
$date = mysql2date( $_format, $comment_date, $translate );
/**
* Filters the returned comment time.