From ed59d4f04308d79830edb01cf0da4cd29fe2f4a0 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Fri, 15 Apr 2022 13:47:12 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@53187 git-svn-id: http://core.svn.wordpress.org/trunk@52776 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/author-template.php | 6 +++--- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 3f28492377..a4f2a1815a 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -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 : '' ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index c33353bbb1..fd693c57bc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta1-53186'; +$wp_version = '6.0-beta1-53187'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.