images 2021 12 24T202507.781

Add Custom Post Types to Your Main WordPress RSS Feed {Beginner’s Guide}

Last Updated on December 24, 2021 by Oluwatuyi

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

It is more than necessary to use custom post types for other content, which means you may want to include them in your main RSS feed as well.

An RSS which simply means Really Simple Syndication feed which is an online file that contains details about every piece of content a site has published. Each time a site publishes a new piece of content, details about that content including the full-text of the content or a summary, publication date, author, link, etc.

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

Why You need to 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.

customposttype

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:/websiteurl.com/custom-post-type/feed/
https://websiteurl.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.

Let’s see how to easily fix that by adding custom post type to 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.

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

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.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.

We hope this article helped you add custom post types to your main WordPress RSS feed.

If you have any issue on this, you can use our comment session or join our delegate on facebook to solve any issues related to WordPress and subscribe to our YouTube Channel for WordPress video tutorials.

Share this Post

Leave a Comment

Your email address will not be published.

Scroll to Top