1

I'm trying to create custom RSS feed that will contain one post type and posts there from just one category. URL to this feed should be /rss.

I tried some plugins but didn't found any that will help me with this. Also, I used some plugin to disable feeds from core because I don't need them anymore.

Is there some way to achieve this and how? Some plugins or examples would be great.

1

Yes, it is possible to customize feeds. In your case, what you want to do is disable to normal rss feed and replace it with a template of your own. Like this:

remove_action ('do_feed_rss','do_feed_rss',10,1);

This line is a bit confusing. The first do_feed_rss is the name of the action hook. The second is the default function on that hook. Now you can add a new action:

add_action( 'do_feed_rss', 'wpse305438_custom_rss', 10, 1 );
function wpse305438_custom_rss () {
   load_template( TEMPLATEPATH . '/my-custom-feed.php');
   }

Beware that by default WordPress will relay /rss to /feed. Changing that involves hooking into rewrite_rules_array.

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.