WordPress Snippets at WPcustoms

Add custom post types to your feed

Manage your feed content with this snippet. Set the post types your feed should include by adding their registered names into the array.


/**
 * Snippet Name: Add custom post types to your feed
 * Snippet URL: https://wpcustoms.net/snippets/add-custom-post-types-to-your-feed/
 */
  function wpc_custom_feeds( $vars ) {
if (isset($vars['feed']) && !isset($vars['post_type']))
$vars['post_type'] = array( 'post', 'movies'); // add your custom post types here
return $vars;
}
add_filter( 'request', 'wpc_custom_feeds' );