Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created August 30, 2017 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/a1464da470313a6c6cf9ff8afd8622b5 to your computer and use it in GitHub Desktop.
Save strangerstudios/a1464da470313a6c6cf9ff8afd8622b5 to your computer and use it in GitHub Desktop.
Tell WordPress to only include posts of type post in the RSS feed.
/*
Only posts of type post in the RSS feed.
*/
function my_pre_get_posts_filter_rss($query) {
if ($query->is_feed) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','my_pre_get_posts_filter_rss');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment