How to Add Custom Post Types to main RSS feed in WordPress

The below code helps you to add your custom post types to sites main RSS feed by default. Just copy and paste the below code in your functions.php file, then change your post type name.

// ADD CUSTOM POST TYPES TO THE DEFAULT RSS FEED
function custom_feed_request( $vars ) {
$post_type = 'post_type'; //change your post type here
 if (isset($vars['feed']) && !isset($vars[$post_type]))
  $vars[$post_type] = array( 'post', 'site', 'plugin', 'theme', 'person' );
  return $vars;
}
add_filter( 'request', 'custom_feed_request' );

 

 

This post has already been read 3531 times!

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.

More Posts

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.