Adding Custom Post Type to Default RSS Feed

Ever since WordPress 3.0 rolled out, Custom Post Type was one of the most talked about topic. CPT definitely paved the way for web designers and developers to expand their horizon and take WordPress little more seriously. Making WordPress from a simple blog site manager to a full fledged web CMS.

However, like regular blog posts, CPT posts doesn't show up on your default RSS feed url. Default RSS feed of your site (for posts) should be:

On the other hand, default CPT RSS feed url can found from:

Here "CPT" would replace with your registered CPT type. It would vary depending on how you have registered your CPT type. This could be a bit confusing for users unless you add direct link of your CPT type on your site.

But there is a way to add all of your CPT posts on your default RSS feed. Simply place the following snippet on your current theme's functions.php file and save it.

function cpt_on_feed($qv) {
   if (isset($qv['feed']) && !isset($qv['post_type']))
     $qv['post_type'] = array('post','CPT');
     return $qv; }

Check your default RSS feed after adding few more posts on your CPT type.

Source: WP Discussion.


Commenting is disabled.