WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a private site where the comments need to be hidden. I know how to remove the comments feed from the header, but can anyone give me some instructions on how to disable the comments feed altogether. Because all you need to do is add /feed/ to the single post and then you can see the comments feed.

I tried creating feed-atom-comments.php, and feed-rss2-comments.php, and that still did not work.

share|improve this question
up vote 2 down vote accepted

Something like this should work.

function wpse45941_disable_feed( $comments ) {
    if( $comments ) {
        wp_die( 'No feed available' );
add_action('do_feed', 'wpse45941_disable_feed',1 );
add_action('do_feed_rdf', 'wpse45941_disable_feed',1 );
add_action('do_feed_rss', 'wpse45941_disable_feed',1 );
add_action('do_feed_rss2', 'wpse45941_disable_feed',1 );
add_action('do_feed_atom', 'wpse45941_disable_feed',1 );

Note: I haven't tested that at all, I just wrote it right into the answer box.

share|improve this answer
I just tested this for a client of mine, and so far seems to be working perfectly. The specific problem was to turn off comments feed for individual posts. Thank you :-) – Lars Koudal Aug 8 '12 at 15:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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