Remove Comment Feeds
Removes comment feed links from the page head and redirects comment feed URLs to the homepage, while keeping the post feeds.
Opens WPIDE on
Code
add_filter( 'feed_links_show_comments_feed', '__return_false' );
add_filter( 'feed_links_extra_show_post_comments_feed', '__return_false' );
add_action( 'template_redirect', function () {
if ( is_comment_feed() ) {
wp_safe_redirect( home_url( '/' ), 301 );
exit;
}
}, 1 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.