Rss feed for Custom Post Type – WordPres


Custom Post Types 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. 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 will share how you can add Custom Post Types to your main WordPress RSS feeds.
Add the following function in functions.php to make rss feed for all custom type

function feed_request($result) {
if (isset($result[‘feed’]))
$result[‘post_type’] = get_post_types();
return $result;
}
add_filter(‘request’, ‘feed_request’);

if we want to some specific custom types rss feed then the following code will be need

Add the following function in functions.php to make rss feed for all custom type

function feed_request($result) {
if (isset($result[‘feed’]) && !isset($result[‘post_type’]))
$result[‘post_type’] = array(‘post’, articles, images, ‘movies’);
return $result;
}
add_filter(‘request’, ‘feed_request’);

,

Leave a Reply