Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am currently working on the completion of a custom template and my last hurdle is to be able to remove the comments feed link being added to the head of the page.

For example: in firefox when you open any of the pages on my site there is an rss icon, when clicked I am shown 3 options to add to my reader but the last two are related to comments.

The culprits are located in the

<link rel="alternate" type="application/rss+xml" title="Example Title &raquo; Comments Feed" href="http://example.com/comments/feed" />
<link rel="alternate" type="application/rss+xml" title="Example Title &raquo; Home Page Comments Feed" href="http://example.com/home-page/feed" />

I wish to have the main feed, which contains blog posts from the blog area of the site but do not want any comments, therefore comment feeds are useless to me!

I am wondering if there is a way I can remove these via the functions.php or some way through wordpress rather than coming up with another (messier) solution?

Thanks, Tristan

share|improve this question

migrated from stackoverflow.com Jun 27 '12 at 14:17

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 1 down vote accepted

Add this to functions.php

function remove_comments_rss( $for_comments ) {
    return;
}
add_filter('post_comments_feed_link','remove_comments_rss');
share|improve this answer
    
This removed one of the links in the head, the following still remains: <link rel="alternate" type="application/rss+xml" title="Example &raquo; Comments Feed" href="example.com/comments/feed"; /> –  TGuimond Jan 7 '11 at 14:18
    
In this case you have to edit wp-includes/feed-atom-comments.php and delete the line with the comments_link_feed(), as it uses get_comments_link and there's no filter to disable it as it's with post_comments_feed_link. –  Sergi Jan 7 '11 at 14:53

This is what most plugins and devs use:

remove_action( 'wp_head', 'feed_links_extra', 3);

Add it in your theme's functions.php (before the last ?> if you don't know what you are doing).

share|improve this answer

None of the above solutions worked for me on Wordpress 3.3.2.
In a category page, for example I had:

application/rss+xml" title="title feed" href="http://www.example.com/feed/" />
application/rss+xml" title="Title Comments Feed" href="http://www.example.com/comments/feed/" />
application/rss+xml" title="Title Category Feed" href="http://www.example.com/cat/feed/" />

To remove the first and the second line (main feed and comments feed), I'v haded the following code to /wp-content/themes/my-theme-name/functions.php

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

On main page none of those will be displayed.

share|improve this answer
1  
WordPress 3.3.2 is outdated and should not be used anymore. –  toscho Dec 6 '12 at 19:02
    
True! :) Also worked on Wordpress 3.4.2. –  PJunior Dec 7 '12 at 12:43

Your Answer

 
discard

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.