Skip to content

Instantly share code, notes, and snippets.

@kneupmedia
Created November 18, 2017 13:45
Show Gist options
  • Save kneupmedia/a845e96511a1d3c7bd7eabd7cc7df97c to your computer and use it in GitHub Desktop.
Save kneupmedia/a845e96511a1d3c7bd7eabd7cc7df97c to your computer and use it in GitHub Desktop.
Add Custom Post Type to WordPress Feed
add_filter('pre_get_posts', 'add_cpt_to_main_feed');
function add_cpt_to_main_feed($query){
if ( $query->is_feed() ){
$query->set( 'post_type', array('post', 'my_custom_post_type') );
}
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment