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://www.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' ); 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x