How to add custom post types to your default RSS feed

Code Snippet Related Categories

Reason for needing the Code Snippet

RSS readers are somewhat old school in 2020, but the RSS feed that is part of WordPress is used by email services like Mailchimp and Mailerlite to create automated email updates when you add a new post to your website.

If you have custom post types though, they are not included in the default URL:

https://yoursite.com/feed

(This post was viewed 549 times) in the last month.)

What the Code Snippet does

If you need to combine your custom post type feed with a standard post feed with only specific categories or tags take a look at this post:

click to go to the Post

You can create a custom feed by adding a parameter, e.g.

https://yoursite.com/feed?post_type=custom-post-type-slug

for your custom post types, but that only gets that one post type.

What I wanted was a feed that included the standard WordPress posts AND the custom post type posts.

Now I can have readers of WordPress Website Coach subscribe specifically to get updates to these Code Snippets or all new posts (including the code-snippet custom post type).

Here's the Code Snippet

I found a good article with a solution that works.

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

Last updated on by Editorial Staff Custom Post Type s 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.

The solution is to add the following to your functions.php file:
/**
* add custom post types to main rss feed
**/
function myfeed_request($qv) {
if (isset($qv['feed']) && !isset($qv['post_type']))
$qv['post_type'] = array('post', 'your-custom-post-type-slug');
return $qv;
}
add_filter('request', 'myfeed_request');

This code will then include all Posts and the custom post types you specified in the functions.php code in your /feed results. Be sure to put in your custom post type slug(s) in the array above. You can add multiple post types separating them with commas.

Limit search for phrases by using " " around the phrase

Subscribe to Code Snippet updates

You will get an email the morning after we post a new Code Snippet

Something went wrong. Please check your entries and try again.

Other Recent Code Snippets

Bulk remove posts from category 1

Bulk remove posts from category

Posted in ,

After creating a child category I wanted to remove the parent category from 30 posts. I finally searched for “how to remove a post category in bulk edit in wordpress” and and lo and behold the second result led me to this plugin. It works perfectly. I’m only sorry I […]

Read More
wizard of oz lions, tigers, and bears

Privacy, Cookies, & ADA Compliance — Oh My!
— Privacy Pt. 1

Posted in , , , ,

With more and more privacy laws on the horizon, we advise all of our clients to not only have a Privacy Policy in place but also have a strategy to keep it up to date with newly required disclosures. An up to date Privacy Policy can help you avoid significant […]

Read More
Elementor vs Beaver Builder review

Elementor vs Beaver Builder review

Posted in , , ,

I came across an Elementor vs Beaver Builder comparison review that was published in August 2020. While I am pretty biased in favor of the Beaver Builder platform the reviewer seemed to favor Elementor. If you are trying to decide which page builder platform to use I’d encourage you take […]

Read More
Mix and Match your RSS feeds 2

Mix and Match your RSS feeds

Posted in , , ,

Ever want to provide your readers with email updates to your website? WordPress’ built in RSS feed functionality provides an easy way to provide the content to email newsletter services like Mailchimp or Mailerlite. But what if you want to create email updates that don’t include all your new posts, […]

Read More
Online GIF tools for regular and animated GIF images 6

Online GIF tools for regular and animated GIF images

Posted in , ,

I made an animated gif screenshot recording to demonstrate a code snippet, but I wanted to resize the image and make it loop. I found a useful website that has easy tools to do that. I reduced the size by 50% and made it auto-loop 30x. Then optimized it to […]

Read More
When should I NOT use WordPress for a website 9

When should I NOT use WordPress for a website

Posted in , , , ,

click the green switch at the top of the screenshots to compare the WordPress vs the Static HTML versions of the same website the static version is live at: http://halcyonlearning.com/ (This post was viewed 134 times) in the last month.)

Read More

Popular Posts


Pieter Hartsook

WordPress website coaching, design, implementation, support, and training. Background in Marketing Research and Communications. See my profile at: https://www.linkedin.com/in/hartsook/

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *

Skip to content