Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Wordpress Comment Feed Link from header

I am talking about this line of code

<link rel="alternate" type="application/rss+xml" title="example.com &raquo; Comments Feed" href="http://example.com/comments/feed/" />

I have tried adding a remove action hook manually in template's functions.php

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

But it doesn't remove it.

I have tried wordpress head cleaner plugin unfortunately it also couldn't remove it.

At last I have edited wp-includes/default-filters.php and commented out

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

My comment feed links are still there. I prefer functions.php modification or plugins other than modifying the core files.

I have tried disabling all the plugins and gone back to default theme but looks like the solution is not plugin or theme dependent. Unfortunately nothing works! I am using wordpress 3.2.1

like image 864
coolsaint Avatar asked Aug 25 '11 01:08

coolsaint


1 Answers

Try this one instead.

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

Yours is for things like category feeds if I recall correctly.

Based on link coolsaint provided you could remove both and then explicitly add back in the posts feed. It isn't the most elegant, but it does mean you don't have to modify the core WP files.

add_action('wp_head', 'addBackPostFeed');
function addBackPostFeed() {
    echo '<link rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed" href="'.get_bloginfo('rss2_url').'" />'; 
}
like image 134
mrtsherman Avatar answered Sep 27 '22 18:09

mrtsherman