Co-Authors-Plus icon indicating copy to clipboard operation
Co-Authors-Plus copied to clipboard

Wrong user description showing on Author archive

Open robmaurizi opened this issue 7 years ago • 0 comments

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' );

robmaurizi avatar Jan 11 '19 21:01 robmaurizi