mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 01:24:27 +00:00
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:
@@ -2525,11 +2525,9 @@ function get_the_date( $format = '', $post = null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! is_string( $format ) || '' === $format ) {
|
||||
$format = get_option( 'date_format' );
|
||||
}
|
||||
$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
|
||||
|
||||
$the_date = get_post_time( $format, false, $post, true );
|
||||
$the_date = get_post_time( $_format, false, $post, true );
|
||||
|
||||
/**
|
||||
* Filters the date a post was published.
|
||||
@@ -2595,10 +2593,10 @@ function get_the_modified_date( $format = '', $post = null ) {
|
||||
if ( ! $post ) {
|
||||
// For backward compatibility, failures go through the filter below.
|
||||
$the_time = false;
|
||||
} elseif ( empty( $format ) ) {
|
||||
$the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_modified_time( $format, false, $post, true );
|
||||
$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
|
||||
|
||||
$the_time = get_post_modified_time( $_format, false, $post, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2654,11 +2652,9 @@ function get_the_time( $format = '', $post = null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! is_string( $format ) || '' === $format ) {
|
||||
$format = get_option( 'time_format' );
|
||||
}
|
||||
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
|
||||
|
||||
$the_time = get_post_time( $format, false, $post, true );
|
||||
$the_time = get_post_time( $_format, false, $post, true );
|
||||
|
||||
/**
|
||||
* Filters the time a post was written.
|
||||
@@ -2843,10 +2839,10 @@ function get_the_modified_time( $format = '', $post = null ) {
|
||||
if ( ! $post ) {
|
||||
// For backward compatibility, failures go through the filter below.
|
||||
$the_time = false;
|
||||
} elseif ( empty( $format ) ) {
|
||||
$the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_modified_time( $format, false, $post, true );
|
||||
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
|
||||
|
||||
$the_time = get_post_modified_time( $_format, false, $post, true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user