Where to remove from comment’s feed?

I can’t seem to find where to delete/comment the line that prints:

<link rel="alternate" type="application/rss+xml" title="[site title] [single title] RSS de los comentarios" href="https://wordpress.stackexchange.com/questions/190509/[site_url]/post/[single title]/feed/" />

I’ve seen that there’s a few plugins for this, but I just want not to rint this line…

If found this here

remove_action( 'wp_head', 'feed_links' );
remove_action( 'wp_head', 'rsd_link');
remove_action( 'wp_head', 'wlwmanifest_link');
remove_action( 'wp_head', 'index_rel_link');
remove_action( 'wp_head', 'parent_post_rel_link');
remove_action( 'wp_head', 'start_post_rel_link');
remove_action( 'wp_head', 'adjacent_posts_rel_link');
remove_action( 'wp_head', 'wp_generator');

Wich looks great, but not working for me..

Any thoughts?

4 Answers
4

Things added by WordPress core can not be deleted or removed, or better said, shouldn’t be modified directly. Instead, you can use any of the actions and filters.

Specifically, to disable comments feeds, you can use this (note the priority parameter):

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

The above code will remove also other posts feed link, there is no specific action for comments links. So, if you want to add other feed links you need to add them manually, for example:

add_action( 'wp_head', function() {

    echo '<link rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed" href="'.get_bloginfo('rss2_url').'" />';

} );

Also, you must know that automatic feed links in <head> is a theme feature, so, if you want to remove them you can also look for and remove this line in your theme functios.php:

add_theme_support( 'automatic-feed-links');

If none of these code snippets work, look for hard coded feed links in your theme, for example in header.php. If you find that links hardcoded in a template, you can complaint to the theme developer; that links shouldn’t be there.

UPDATE

Since WordPress 4.4.0 you can use feed_links_show_comments_feed filter to specifically remove comments feed link:

add_filter( 'feed_links_show_comments_feed', '__return_false' );

Leave a Comment