Custom Post Types were one of the most hyped features of WordPress 3.0. This feature alone expanded the horizon of using WordPress as a Content Management System (CMS). If you're using custom post types, or thinking about custom post types, then you may need to add them to 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'll share how you can add custom post types to your main WordPress RSS feeds.
You would have to open the theme of your functions.php file and add the following code inside the PHP markup:
function myfeed_request ($ qv) if (isset ($ qv ['feed'])) $ qv ['post_type'] = get_post_types (); devuelve $ qv; add_filter ('request', 'myfeed_request');
This code modifies the query to keep the default content type for blog posts "publish" in the main RSS feed, and also add 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 a problem because we'll just modify the code slightly to give you the option to include only the ones you want.
function myfeed_request ($ qv) if (isset ($ qv ['feed']) &&! isset ($ qv ['post_type'])) $ qv ['post_type'] = array ('post', 'story', «libros», «películas»); devuelve $ qv; add_filter ('request', 'myfeed_request');
If you see in the code above, we simply added an array to modify the post types to display in the main RSS feed. We are showing the default posts, stories, books and movies.
Source:Core Trac Ticket #12943