Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Add Custom Post Types to Your Main WordPress RSS Feed

Do you want to add custom post types to your main WordPress RSS feed?

By default, the WordPress RSS feed only shows your recent blog posts. However, if you are using custom post types for other content, then you may want to include them in your main RSS feed as well.

In this article, we’ll show you how to easily add custom post types to your main WordPress RSS feed.

Easily add custom post types to main WordPress RSS Feed

Why Add Custom Post Types to Main RSS Feed in WordPress?

By default, WordPress comes with two commonly used content types called posts and pages. However, you can also create custom post types to add more content types if needed.

For instance, a movie review website may want to create a custom post type for movie reviews using custom taxonomies suitable for that particular content type.

A custom post type in WordPress

Now, your custom post types can have their own RSS feed which users can access by adding /feed/ at the end of the custom post type archive URL.

https://example.com/custom-post-type/feed/
https://example.com/movies/feed/

However, the custom post-type feeds are not easily discoverable. If a user enters your website’s URL in their feed reader, then it will show the subscription option for your main WordPress RSS feed.

Feed reader showing main RSS feed at the top

That being said, let’s see how to easily fix that by adding custom post type to your main WordPress RSS feed.

Adding All Custom Post Types to Your WordPress RSS Feed

This method allows you to add all publicly available post types to be included in your main WordPress RSS feed.

You’ll need to add code to your WordPress website. If you haven’t done this before then take a look at our guide on how to easily add custom code snippets in WordPress.

Simply copy and paste the following code to your theme’s functions.php file or a site-specific plugin.

function myfeed_request($qv) {
if (isset($qv['feed']))
$qv['post_type'] = get_post_types();
return $qv;
}
add_filter('request', 'myfeed_request');

This code simply modifies the default WordPress query to fetch RSS feeds by adding all publicly visible post types into the query.

This will allow you to add pages as well as all other custom post types into your main WordPress RSS feed.

Adding Specific Custom Post Types in Main WordPress RSS Feed

This method is more flexible and allows you to choose which post types you want to include into your main WordPress RSS feed.

Simply copy and paste the following code into your WordPress website.

function myfeed_request($qv) {
    if (isset($qv['feed']) && !isset($qv['post_type']))
        $qv['post_type'] = array('post', 'movies', 'books');
    return $qv;
}
add_filter('request', 'myfeed_request');

You can now visit your WordPress RSS feed to see this code in action.

We hope this article helped you add custom post types to your main WordPress RSS feed. You may also want to see our tips to optimize WordPress RSS feeds or see these best WordPress RSS feed plugins for bloggers.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

41 CommentsLeave a Reply

  1. Hi,

    This doesn’t appear to work with custom post types that are not using a custom taxonomy. We are using a CPT with the ‘category’ taxonomy. Is this why it isn’t working?

    e.g. mysite.com/feed?post_type=news&category=economy

    • It should still work for those custom post types, you may want to ensure you’re adding the correct name for your custom post type

      Admin

  2. Hi
    thank you for your Teaching.

    i use edd in my site, when i want to see edd feed, download category and download tag are not shown in a rss feed.

    at all: in a custom post type, how can i add post type category , post type tag to a feed?

    default WordPress feed for default post type, category and tag show nicely.

    i’m waiting for your answare.

  3. Feeds are automatically added in the section dedicated for the custom post type example.com/feed/?post_type=books . You can just add an RSS icon linking to the earlier link.

  4. I wanted to include ALL Custom Post Types so I used this first snippet.
    This included submissions to my Jetpack contact form!
    Unfortunately that took me a while to notice!

    Using the 2nd snippet to define each post type in the array fixed the issue.

  5. Hello,
    I meet an issue with a CPT.
    I add a CPT ‘cpt1’ to my feed amont others CPT, but cpt1 does not show in the feed.
    When I put cpt1 alone in the feed, it works.

    any help would be greatly appreciated.
    Regards.

      • I just want to ask you something, you could see your CPT in your-site.com/feed? I’m using CPT and WPML, but my CPT never shows in your-site.com/feed, just my normal posts.

        I follow this comment:

        And all the CPT I choose are showing in the Feed reader but never in your-site.com/feed. I desactivate and reactivate WPML still not showing in the URL. I appreciate a lot if you could tell me if your CPT are showing in the URL for the Feed (your-site.com/feed).

  6. What if you don;t know the names of the custom post types you want to include in your feed (in example 2) – i.e. I have a webcomic,, & I know the custom post-type for that is “webcomic_post”, but I also want to include posts to my portfolio & woo commerce store products. When I use the first version of the code, these items all show up in the feed, pus some other stuff I want to exclude. The problem is that I don;t know the names of the custom post types being used, and I don’t know how to find them out? I did try ‘product’ and ‘portfolio’ but those didn’t work. I am a bit of a noob at WordPress, so apologies if this is a dumb question — Any help much appreciated!

    • When you’re in WordPress, hover over the “Portfolio” link, for example, in the left navigation. This should point you at a URL where you can see all of your Portfolio items. Go to that page and look in the address bar, you’ll see the name of the post type listed there.

  7. Cheers, a quick and easy tip that worked straight away for me. I’ve basically got no ‘posts’ but two custom post types so I had nothing showing in my feed before I edited the functions.php.

    cheers again, Neil

  8. Excellent tip, works like charm!

    Want to merge WooCommerce feed to main blog’s feed, thanks again!

  9. I realize this post is older, but it came in handy today, so thanks! One tip for those that use Jetpack and don’t want to embarrass their visitors, use the second method, not the first! The first method publishes the “feedbacks” CPT to the RSS feed, which are all of the contact form submissions from your site. Oops!

  10. My last changes in my function.php file :

    <code>

    /*———————————————————————————–*//* Add Post format in RSS/*———————————————————————————–*/ function myfeed_request($qv) { if (isset($qv[‘feed’])) $qv[‘post_type’] = get_post_types(array( ‘public’ => true ) ); return $qv;}add_filter(‘request’, ‘myfeed_request’);

    </code>

  11. You should use get_post_types( array( ‘public’ => true ) ) instead of get_post_types() because you may not want the post types which are set not to be a publicly querable to be included in the feed.

      • I’ve just found this function and implemented this code (the first one for adding all custom post types) and it works great for adding my custom posts type to my main feed.

        However, it has also added my pages to my feed. I thought this should only add posts, not pages?

        How do I exclude pages?

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.