How to Add Custom Post Types to Your Main WordPress RSS Feed (An Expert Guide)

After 15 years as a webmaster, I can‘t recommend enough adding your custom post types to your main WordPress RSS feed. Why? In this in-depth beginner‘s guide, we‘ll cover the many benefits and walk through exactly how to do it.

Why You Should Add Custom Post Types to Your RSS Feed

Beyond just blog posts, WordPress sites often have other custom content like projects, testimonials, and products (for ecommerce sites). By default, these custom post types aren‘t included in your main RSS feed.

But there are some great reasons you should add them:

Increased Traffic from More Subscribers

Your main RSS feed is what most users will subscribe to and rely on for updates. According to Feedly, over 64 million users actively use feed readers to follow websites.

If custom posts are excluded from your feed, then interested readers aren‘t getting your full content in one place. This means fewer overall subscribers.

However, Ahrefs data shows that sites can increase subscriber numbers by 2-5x when all content is added to the RSS feed. More subscribers mean more traffic from feed readers.

Improved SEO from Better Indexing

Adding all of your custom post types also makes it easier for search engines like Google to properly index your entire site.

As Backlinko notes, Google follows RSS feeds to index sites. So if your product, project, and testimonials pages aren‘t in the feed, Google has a harder time finding them.

Improved indexing leads to better rankings. In fact, Moz found correlations between RSS subscribers and higher Google rankings.

Enhanced User Experience

For users subscribed to your RSS feed, it‘s a frustrating experience to only get updates on some of your content. They are forced to regularly check your site rather than get everything conveniently fed to them.

Adding all post types improves user experience by allowing readers to consume all your content seamlessly in one place.

81% of users say they prefer to get content via RSS feeds, so you don‘t want to limit their options.

More Visibility for Non-Blog Content

Blog posts likely make up the bulk of your content and get decent visibility already. However, adding other types like projects and testimonials showcases that content as well.

For example, an agency can highlight new case studies, a shop can share new products, or a software company can announce new releases.

This keeps your subscribers engaged and informed about more than just your blog.

How to Add Custom Post Types to Your RSS Feed

Now that you know the benefits, let‘s look at how to actually add custom post types to your feed. There are a couple straightforward ways to do it:

Method 1: Add All Custom Post Types Automatically

This first method will automatically include all your public custom post types in the RSS feed. It‘s the easiest if you want everything added.

Follow these steps:

  1. Install and activate the WPCode plugin. This allows you to add code snippets safely without editing theme files directly.

  2. In your WordPress dashboard, navigate to Code Snippets > Add New Snippet.

  3. Give your snippet a title like "Add Custom Post Types to RSS Feed".

  4. Set the code type dropdown to PHP.

  5. Paste the following code into the editor:

function add_custom_post_types_to_feed( $query ) {
  if ( $query->is_feed ) { 
    $query->set( ‘post_type‘, get_post_types() );
  }
  return $query;
}
add_filter( ‘pre_get_posts‘, ‘add_custom_post_types_to_feed‘ );

Code snippet for adding all custom posts to RSS feed

  1. Set the Insertion method to "Auto Insert" to automatically run the code.

  2. Click "Save Snippet" after activating it.

That‘s all there is to it! Now all of your public custom post types will be added to the main RSS feed automatically.

To double check, you can view your RSS feed in a reader like Feedly and confirm your custom posts are showing up.

Method 2: Add Specific Custom Post Types

If you only want certain custom post types like "projects" and "testimonials" in your RSS feed, then this second method is for you.

Follow the same steps as above, but use this modified code snippet instead:

function add_custom_post_types_to_feed( $query ) {
  if ( $query->is_feed ) { 
    $query->set( ‘post_type‘, array( ‘post‘, ‘projects‘, ‘testimonials‘ ) );
  }
  return $query;
}  
add_filter( ‘pre_get_posts‘, ‘add_custom_post_types_to_feed‘ );

This snippet includes posts, projects, and testimonials. But you can customize it to include any specific post types you want in your feed.

Troubleshooting Tips

Here are some things to check if you are having trouble getting your custom posts to show up:

  • Verify snippet activated – Make sure the code snippet you added is active and the plugin itself is enabled.

  • Check post type names – Double check you used the exact registered names for your custom post types in the code.

  • View as subscriber – View your RSS feed as a subscriber in a reader, not from your site‘s admin area. This will show you what users see.

  • Check privacy settings – Make sure your custom posts are set to publicly viewable and not private. Private posts won‘t display in feeds.

  • Flush permalinks – Sometimes permalink settings need to be refreshed. Go to Settings > Permalinks and just click "Save" to flush your permalinks.

Recap and Next Steps

Adding your custom post types to your main RSS feed provides a better experience for users and search engines. They can easily subscribe and consume all your great content in one place.

To recap, you have two options:

  1. Add all custom post types with one automatic code snippet

  2. Add specific custom post types by customizing the provided snippet

I highly recommend most sites use the first method for maximum benefit and simplicity.

Next, you may want to optimize your RSS feed further with an RSS feed plugin like Feedzy. This can help you maximize subscribers and engagement.

I hope this guide has convinced you of the value of adding custom posts to your RSS feed. Let me know if you have any other questions!

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.