Custom taxonomy in custom post RSS feed

I'm trying to add a custom taxonomy (Topics) from my custom post-type to the proper post-type RSS feed. ex: ?post_type=custom_post_type

I'm pulling the RSS feed from my main site to another site using WP RSS Aggregator's feed to post add-on, but when I pull it, the custom taxonomy (Topics) isn't being populated when the posts are fetched.

I'm a rookie with RSS and PHP so any help is appreciated! Thanks!

Topic feed rss custom-taxonomy custom-post-types Wordpress

Category Web


You can hook into the request filter and set the post types to whatever you wish:

add_filter( 'request', 'cpt_in_rss' );

function cpt_in_rss( $request ) {

    if ( isset( $request['feed'] ) && ! isset( $request['post_type'] ) ) {
        $request['post_type'] = [ 'post', 'cpt1', 'cpt2' ];
    }

    return $request;

}

Here's a trac ticket about what you are asking.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.