Automattic / Automattic/co-authors-plus

Wrong user description showing on Author archive

Open
#643 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
PHP
Stars
322
Forks
216
Avg merge
7h 50m
Merged PRs (30d)
65

Description

It seems that the author description that's being shown on the author archive is generated by pulling the author of the first post in the result set. However, if the first post contains co-authors, and the author in question is NOT the primary author of the first post, the description appears wrong.

Using the following filter works around the issue:

function mp_author_description_filter( $description ) {

if ( ( is_author() ) && ( function_exists( 'coauthors_posts_links' ) ) ) {

$a = get_user_by( 'slug', get_query_var( 'author_name' ) );
if ( $a ) {
return $a->description;
}

}

return $description;
}
add_filter( 'get_the_archive_description', 'mp_author_description_filter' );

Contributor guide

Open the contributing guide

Research direction

Start at the get_the_archive_description filter and compare its current author selection with the provided get_user_by and author_name workaround. Reproduce an author archive whose first result has co-authors, then verify the archive displays the requested author's description rather than the primary author's description.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.