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

In WordPress 3.0 introduced the most glorified feature Custom Post Type. Due to only this feature extended the usage of WordPress as a Conant Management System (CMS). If anyone is working with Custom Post Types and adding different type of information in their WordPress site. But here one thing keep in mind wordpress does not add Custom Post Type in RSS feed so you can not spread your Custom Post Type data using RSS feed. WordPress is not giving any built-in option to adding CPT data in main RSS feed not even pages.

In this article I will share PHP code with you that will help you to add Custom Post Types data in to your main WordPress RSS feeds.

This is very simple to add first of all open functions.php file from your theme and add this following code within the PHP markups.

This code will change the query to continue the default post type in main RSS feed and also will add your new Custom Post Types.

But if you are working with multiple custom post types in your WordPress website and don’t want to include all Custom Post Types in RSS feed and you want add only two or three CPT to the main RSS feed then use this following code.

If you check the above code, I am simply adding an array to change the post_types. These post types only will display in RSS feed. We are showing the default posts,

Leave a Reply

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