wordpress snippets last updated   : April 14, 2014
we now have 630 snippets

Add custom post types to your sites main RSS feed

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will include the specified custom post types within your primary RSS feed.

snippet :  PHPcopy
function custom_feed_request( $vars ) {
 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' );
source →
  • Anonymous

    That’s a great snippet Kevin! I’ve wondered at how that would be done, very nice to see how simple the code is, thanks!

    • http://wpsnipp.com Kevin Chard

      Sweet glad you like it,

  • Muslim

    How would you restrict this to a specific taxonomy linked to that custom post type, is this possible?

jqsnipp.com | we just launched jquery snippets website