mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
Date/Time: Make sure get_the_date() and related functions return correct time if the format was specified as false.
Technically, the `$format` argument should always be a string, but passing `false` used to work before [47808], so this restores backward compatibility. The list of affected functions: * `get_the_date()` * `get_the_time()` * `get_comment_date()` * `get_comment_time()` Props wittich, Rarst, akabarikalpesh, SergeyBiryukov. Fixes #51184. git-svn-id: https://develop.svn.wordpress.org/trunk@48912 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user