Query: Ensure the author archive title always shows the name of the queried author, regardless of whether there are results.

This brings the behaviour inline with the `<title>` element of the page which always shows the author name.

Props Tkama, subrataemfluence

Fixes #44183


git-svn-id: https://develop.svn.wordpress.org/trunk@49843 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2020-12-20 14:35:58 +00:00
parent a706d9e189
commit b04671e52f
2 changed files with 35 additions and 2 deletions

View File

@@ -597,8 +597,8 @@ class WP {
$GLOBALS['single'] = 1;
}
if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
if ( $wp_query->is_author() ) {
$GLOBALS['authordata'] = get_userdata( get_queried_object_id() );
}
}