0

I am using a theme with many custom post types but I would like my main RSS feed www.domain.com/feed to show posts and custom post types from one category only.

The categoy is defined within Posts / Categories.

  1. How can I do this?
  2. Is this bad for SEO?

In any case, I have noticed that my posts take a few days to be indexed by Google even if they are included in the RSS feed.

0

This should work for you if you put it in the functions.php file in your theme. Just replace where I have "CATEGORY NAME HERE" with the category name.

function custom_feed_wpse_128087($qv) {
    if (isset($qv['feed'])) {
        $qv['post_type'] = get_post_types();
        $qv['category_name'] = 'CATEGORY NAME HERE';
    }
    return $qv;
}
add_filter('request', 'custom_feed_wpse_128087');
  • I have added this but nothing seems to happen .. I have also tried 'category_id'... – Joanna Mikalai Dec 31 '13 at 0:17
  • Remove $qv['category_name'] = 'CATEGORY NAME HERE'; to make sure your custom post types are showing in the main feed. If they do, are you using register_taxonomy_for_object_type('category', 'POST TYPE HERE'); when you created your custom post types? – kel Dec 31 '13 at 15:07
  • The custom post types are indeed showing and i am not using this statement you are mentioning – Joanna Mikalai Jan 1 '14 at 18:45
  • @JoannaMikalai by default custom post types are not using the default categories or tags. That other statement is needed when you create your custom post types. Also in the register_post_type function you will need 'taxonomies' => array('category'). Hopefully this helps you out more. – kel Jan 2 '14 at 15:18

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.