Paste this in your functions.php
of the active Theme or leave it in a custom plugin. Replace your-cpt
string.
/**
* Filter the feed, exclude specific custom post type
*
* @param WP_Query object $query
* @return void
*/
function wpse_191804_pre_get_posts( $query )
{
// only for feeds
if( !$query->is_feed || !$query->is_main_query() )
return query;
$exclude="your-cpt";
$post_types = $query->get('post_type');
if (($key = array_search($exclude, $post_types)) !== false)
unset($post_types[$key]);
$query->set( 'post_type', $post_types );
return $query;
}
add_action( 'pre_get_posts', 'wpse_191804_pre_get_posts' );