mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
Users: Avoid warning on the_modified_author
when get_userdata()
returns false
.
This change adds a check of the value returned by `get_userdata()` before using it in `get_the_modified_author()`. It avoids a warning when retrieving the last author who edited the current post. Props juanlopez4691, mukesh27. Fixes #55420. git-svn-id: https://develop.svn.wordpress.org/trunk@53187 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ede6f212af
commit
565fa92c5d
@ -86,7 +86,7 @@ function the_author( $deprecated = '', $deprecated_echo = true ) {
|
||||
*
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @return string|void The author's display name.
|
||||
* @return string|void The author's display name, empty string if unkown.
|
||||
*/
|
||||
function get_the_modified_author() {
|
||||
$last_id = get_post_meta( get_post()->ID, '_edit_last', true );
|
||||
@ -99,9 +99,9 @@ function get_the_modified_author() {
|
||||
*
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param string $display_name The author's display name.
|
||||
* @param string $display_name The author's display name, empty string if unkown.
|
||||
*/
|
||||
return apply_filters( 'the_modified_author', $last_user->display_name );
|
||||
return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user