Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

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

Last updated on by
Follow WPBeginner on YouTube
How to Add Custom Post Types to Your Main WordPress RSS Feed

Custom Post Types was one of the most hyped feature of WordPress 3.0. This feature alone expanded the horizon of WordPress usage as a Content Management System (CMS). If you are using Custom Post Types, or thinking of custom post types, then you may have the urge to add it into your main RSS Feed. This option is not built-in by default because your main WordPress RSS feed only includes “Posts” not even pages, so custom post types are a long shot. In this article, we will share how you can add Custom Post Types to your main WordPress RSS feeds.

You would need to open your theme’s functions.php file and add the following code within the PHP markup:

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

This code modifies the query to keep the default content type for blog posts “post” in the main RSS feed, and also adding new custom post types.

But what if you have five custom post types in your new project, and you only want to add three to the main RSS feed? Well that shouldn’t be any problem because we will just modify the code slightly to give you the option to only include the ones that you want.

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

If you see in the code above, we simply added an array to modify the post_types that will be shown in the main RSS feed. We are showing the default posts, story, books, and movies.

Source: Core Trac Ticket #12943

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Ziacinzia says:

    Hello, could you please advise where exactly should the code go? Thank you

  2. Alex Leonard says:

    Thanks for this – set me in the right direction for a couple of things :)

  3. Kasey says:

    Hi, thanks for this! where in the page does this code need to be added? At the top? Bottom? Thanks so much!

  4. Moaz says:

    worked like a charm ! thnx :)

  5. Neil Curtis says:

    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

  6. Mike says:

    THANK YOU!!!

  7. Sussie T says:

    So nice! Thank you! That was just what I needed. And so simple.

  8. Pranjal says:

    Excellent tip, works like charm!

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

  9. Colin says:

    Boom. This just worked perfectly for me, thankyou thankyou thankyou :)

  10. Juergen says:

    just what I needed

  11. Luke Rumley says:

    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!

  12. Ami says:

    +1 here, worked great, thank you!

  13. MoiMM says:

    My last changes in my function.php file :


    /*———————————————————————————–*//* 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’);


  14. navjotjsingh says:

    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.

  15. closemarketing says:

    Nice hack!

  16. Zeeshan Hamid says:

    I’ve tried every permutation of this over last few weeks and nothing works. I use feedburner, could that be the problem?

  17. Anton says:

    this tutorial shows you a similar way to achieve this and where you dont have to specify each post type –

  18. m says:

    Could you add ‘page’ and so have pages in the feed as well?

    • Editorial Staff says:

      YES. Pages are it’s own custom post type – “page”. So add that along with your other custom post types.

      • Adam W. Warner says:

        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?

  19. Chuck says:

    running that code in functions caused a white screen of death. Looking into why…

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.