mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-03 22:27:04 +00:00
Posts: Fix back-compat for filters in get the modified time and date functions after [37738].
When no valid post exists for `get_the_modified_time` or `get_the_modified_date` calls, the result (`false`) is passed through the functions respective filters to maintain back-compat. Introduces unit tests to ensure filters are applied and for the `get_the_modified_date` function. Fixes #37059. git-svn-id: https://develop.svn.wordpress.org/trunk@37866 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2265,10 +2265,9 @@ function get_the_modified_date( $d = '', $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( empty( $d ) ) {
|
||||
// For backward compatibility, failures go through the filter below.
|
||||
$the_time = false;
|
||||
} elseif ( empty( $d ) ) {
|
||||
$the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_modified_time( $d, false, $post, true );
|
||||
@@ -2421,10 +2420,9 @@ function get_the_modified_time( $d = '', $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( empty( $d ) ) {
|
||||
// For backward compatibility, failures go through the filter below.
|
||||
$the_time = false;
|
||||
} elseif ( empty( $d ) ) {
|
||||
$the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_modified_time( $d, false, $post, true );
|
||||
|
||||
Reference in New Issue
Block a user