thoughtis / cata-co-authors-plus

Common functions, configuration and compatibility fixes for Co-Authors Plus when used in Cata child themes. Not a fork or replacement for CAP.
GNU General Public License v3.0
0 stars 0 forks source link

Show CoAuthors in RSS Feed #13

Closed douglas-johnson closed 3 years ago

douglas-johnson commented 3 years ago

Background

On the development site, the RSS feed shows the creator as <dc:creator><![CDATA[admin]]></dc:creator> even though a Guest Author has been assigned.

Acceptance Criteria

References

We solved this previously on Thought Catalog, but I don't think it checks for the post type.

/**
 * Co-authors in RSS and other feeds
 * /wp-includes/feed-rss2.php uses the_author(), so we selectively filter the_author value
 *
 * @see http://vip-support.automattic.com/tickets/6314
 * @see http://danielbachhuber.com/2011/12/13/co-authors-in-your-rss-feeds/
 */
function tc_coauthors_in_rss( $the_author ) {
    if ( ! is_feed() || ! function_exists( 'coauthors' ) ) {
        return $the_author;
    }

    return coauthors( null, null, null, null, false );
}
add_filter( 'the_author', 'tc_coauthors_in_rss' );