0

I would like to remove all posts with a post type of nf_sub from showing up in any RSS feeds, including comment feeds, how can I do this?

0

Only actual posts appear by default in the RSS feeds. If you have other types of posts in them it is an indication that you have a plugin which is responsible for doing that and you will need to consult its author to learn how to disable the inclusion of the specific post type.

| improve this answer | |
0

Paste this in your functions.php and replace your-cpt.

/**
 * 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' );
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.