1

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!

0

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.

  • Hey man thanks for the answer, but I'm trying to figure out how to get the custom taxonomy to show up in my rss feed. I've got the post-type feed already, its just not carrying over the taxonomy info. – Kenan Philips Feb 21 '18 at 16:23
  • @KenanPhilips Oops my bad there. Here's a similar question to yours. – Jack Johansson Feb 21 '18 at 16:43
  • Thanks! I saw that one earlier, but they're looking to add multiple taxonomies so they're looping through them. I'm gonna take another shot at it and try to fiddle around with that code! Thanks for your help dude! – Kenan Philips Feb 21 '18 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.