Co-authors in your WordPress RSS feeds

I use Co-Authors Plus in one of my client projects, which is awesome. One issue I ran into is that the guest author wasn’t displaying in the standard WordPress RSS feed. Searching online only found one potential fix, which unfortunately didn’t work.

This fix was from 2011, so it’s likely that the WordPress/plugin code has changed enough over time that the fix is no longer effective. However, that original fix was a great basis to work from and here’s my fix:

Place the below code into your theme’s functions.php file:

/**
* Co-authors in RSS and other feeds
* /wp-includes/feed-rss2.php uses the_author(), so we selectively filter the_author value
*/
function db_coauthors_in_rss( $the_author ) {

if ( !is_feed() || !function_exists( ‘coauthors’) ){
#return coauthors__echo( null, null, null, null, false );
return $the_author;
}
else{
#return “hey hey hey”;
return coauthors( null, null, null, null, false );
}


}
add_filter( 'the_author', 'db_coauthors_in_rss');

This is based on the original fix from Daniel Bachhuber: https://danielbachhuber.com.