/* Disable RSS Feed in WordPress */
function disable_feed() {
wp_redirect( home_url() );
die;
}
add_action('do_feed', 'disable_feed', 1);
add_action('do_feed_rdf', 'disable_feed', 1);
add_action('do_feed_rss', 'disable_feed', 1);
add_action('do_feed_rss2', 'disable_feed', 1);
add_action('do_feed_atom', 'disable_feed', 1);
add_action('do_feed_rss2_comments', 'disable_feed', 1);
add_action('do_feed_atom_comments', 'disable_feed', 1);
remove_action('wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 2 );
add_filter('post_comments_feed_link',function () { return null;});
If you don’t use RSS Feeds on your site, add this code to your child theme’s functions.php. This will disable all sorts of RSS links including atom and comment feeds.
This code also removes the RSS link URL’s from the header. If any user manually tries to access RSS link of your site, they will be redirected to the Home Page.
In general, if you are not using RSS feeds, you should disable them. If enabled, they create duplicate content in Search Console where search engines have to filter such links.