diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 9a2d62c586..a048d3870c 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -552,12 +552,12 @@ 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 ( '' === $format ) { - $date = mysql2date( get_option( 'date_format' ), $comment->comment_date ); - } else { - $date = mysql2date( $format, $comment->comment_date ); + if ( ! is_string( $format ) || '' === $format ) { + $format = get_option( 'date_format' ); } + $date = mysql2date( $format, $comment->comment_date ); + /** * Filters the returned comment date. * @@ -1046,12 +1046,12 @@ function get_comment_time( $format = '', $gmt = false, $translate = true ) { $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; - if ( '' === $format ) { - $date = mysql2date( get_option( 'time_format' ), $comment_date, $translate ); - } else { - $date = mysql2date( $format, $comment_date, $translate ); + if ( ! is_string( $format ) || '' === $format ) { + $format = get_option( 'time_format' ); } + $date = mysql2date( $format, $comment_date, $translate ); + /** * Filters the returned comment time. * diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 094e4a4062..89748f1968 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2525,12 +2525,12 @@ function get_the_date( $format = '', $post = null ) { return false; } - if ( '' === $format ) { - $the_date = get_post_time( get_option( 'date_format' ), false, $post, true ); - } else { - $the_date = get_post_time( $format, false, $post, true ); + if ( ! is_string( $format ) || '' === $format ) { + $format = get_option( 'date_format' ); } + $the_date = get_post_time( $format, false, $post, true ); + /** * Filters the date a post was published. * @@ -2654,12 +2654,12 @@ function get_the_time( $format = '', $post = null ) { return false; } - if ( '' === $format ) { - $the_time = get_post_time( get_option( 'time_format' ), false, $post, true ); - } else { - $the_time = get_post_time( $format, false, $post, true ); + if ( ! is_string( $format ) || '' === $format ) { + $format = get_option( 'time_format' ); } + $the_time = get_post_time( $format, false, $post, true ); + /** * Filters the time a post was written. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 7301479dfb..fe385288bd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-48911'; +$wp_version = '5.6-alpha-48912'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.