In a custom post type I have set has_archive to false. In the head of a CPT page however I still find a link to a feed like this:

<link … title="Page Title | Comments Feed" href="domain/cpt/slug/feed/" />

The feed doesn't exist – the link generates a 404 error. I tried to remove the link with the filter feed_links_show_comments_feed which only had an effect on the regular posts' comment feed:

add_filter( 'feed_links_show_comments_feed', '__return_false' );

…the cpt comment feed was still there.

I also tried to rmove all feeds – which again worked on all feeds but the one I wanted to remove:

remove_action( 'wp_head', 'feed_links', 2 );

If I however would set has_archive to true the link would actually lead to a valid rss feed of comments – which I basically wouldn't mind. But I can not have has_archive set to true since I need the base slug for some custom page and I don't want an archives page to appear on the slug's url.

I hope somebody can point me in the right direction? All pointers welcome. Thank you!


2 Answers 2


Following command hides comments feed for posts (WP 4.4+ required!), but custom pages still have comments feed displayed, even if comments are disabled for such page:

add_filter( 'feed_links_show_comments_feed', '__return_false' );

To resolve this, I had to add this addidtional code too:

function remove_comments_rss( $for_comments ) {
  • 3
    Hi there, welcome to WPSE. Can you edit your answer to explain how it answers the question and what the code does? Code only answers are discouraged as they don't teach. Thanks :)
    – Tim Malone
    Commented Aug 4, 2016 at 21:54

You can remove the comments feed for a custom post type by telling WordPress that comments are closed for a particular post type using the comments_open filter:

  function close_comments( $open, $post_id ) {
    if ( 'cpt' == get_post_type( $post_id ) ) {
      $open = false;
    return $open;
  add_filter( 'comments_open', 'close_comments', 10, 2 );

Make sure you replace 'cpt' with your post type name.

  • Just to clarify, this seems to actually close comments on the post type, with the feed link not showing up effectively being a side-effect. That's a pretty major deviation from the actual goal here.
    – Su'
    Commented Feb 2, 2018 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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