Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Turn off comment feeds

Comment feeds (/comments/feed/ and each post’s /feed/) redirect to the post or home page, and their links leave the page head. Your posts feed keeps working.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category RSS feeds
  • Tested with WordPress 7.1
PHP
<?php

add_action(
	'template_redirect',
	static function () {
		if ( is_comment_feed() ) {
			wp_safe_redirect( is_singular() ? get_permalink() : home_url( '/' ), 301 );
			exit;
		}
	},
	1
);
add_filter( 'feed_links_show_comments_feed', '__return_false' );
add_filter( 'post_comments_feed_link', '__return_empty_string' );

In these packs

  • Comments: Fewer spam comments and more control: close old posts, set minimum and maximum lengths, a spam trap, no links.
  • RSS feeds: Control what your RSS feed shows, and when.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.