3

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="[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?

7

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' );
3

From 4.4 on this seems to get easier with a brand-new filter: feed_links_show_posts_feed. So add_filter( 'feed_links_show_comments_feed', '__return_false' ); will do then.

0

The accepted answer did not disable the comment feed for pages and custom post types, just posts. I had to add a new filter to remove it entirely. Here is what I ended up with :

// remove comments feed
add_filter( 'feed_links_show_comments_feed', '__return_false' );
remove_action( 'wp_head', 'feed_links' );
function remove_comments_rss( $for_comments ) {
    return;
}
add_filter('post_comments_feed_link','remove_comments_rss');

Sauce : How to remove CPT comment feed from head?

-1

look in header.php

A trial an error way of finding it is to delete the whole php page, load your wordpress page, check your source (usually ctrl+u depending on browser) and see if your code is there. If not then your code is on that page. If you cant find it still - delete half the page and check. Repeat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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