FindsGood

Home Quotes Specs Blog Forums Topics

How to remove WordPress blog comment feed links permanently

Learn how to remove WordPress blog post comment feed links permanently. And redirect comment feed links to avoid 404 not found errors. Completely remove all comment feed links.

  1. If you don’t want to publish your blog’s post comments via feeds.
  2. You can use this code to permanently remove comment feed links.
  3. And redirect comment feed links to your blog address or you can redirect to any URL, If you want.
//This code will redirect all comment URLs to given URL:
function com_disable_feed( $comments ) 
{   if( $comments ) { wp_redirect( 'http://howtodoany.com/'); exit; }
}
add_action('do_feed', 'com_disable_feed',1 );
add_action('do_feed_rdf', 'com_disable_feed',1 );
add_action('do_feed_rss', 'com_disable_feed',1 );
add_action('do_feed_rss2', 'com_disable_feed',1 );
add_action('do_feed_atom', 'com_disable_feed',1 );

//Removes single post comment feed links:
function remove_comments_rss( $for_comments ) {
return;
}
add_filter('post_comments_feed_link','remove_comments_rss');

/** Removes main home URL feed link and main comment feed link so you can add home feed URL manually: **/
remove_action( 'wp_head', 'feed_links', 2 );
Share with your friends: Facebook Twitter Google+ Blogger Archive

Leave a Reply

Your email address will not be published.