Disable WordPress RSS feed: step-by-step guide

By default, WordPress Generate various RSS feeds such as


It also generates RSS feeds of your blog posts, pages, categories, comments, etc.

Disabling these RSS feeds is a good idea for security and performance enhancement.

In this quick guide, we will explore how to disable the RSS feed in WordPress. 

Disable WordPress RSS feed without a plugin

Before getting started create a backup and use a child theme. With a child theme, you won’t lose your code updates & changes when you update your theme.

Now locate your child theme’s function.php. Copy and paste the below code into your child theme’s function.php.

The code to disable WordPress RSS feed:

function disable_all_feeds() {
wp_die(__('This WordPress does not have Feeds.'));

add_action('do_feed', 'disable_all_feeds', 1);

add_action('do_feed_rdf', 'disable_all_feeds', 1);
add_action('do_feed_rss', 'disable_all_feeds', 1);
add_action('do_feed_rss2', 'disable_all_feeds', 1);
add_action('do_feed_atom', 'disable_all_feeds', 1);
add_action('do_feed_rss2_comments', 'disable_all_feeds', 1);
add_action('do_feed_atom_comments', 'disable_all_feeds', 1);

This code disables all the feeds that WordPress generates by default.

Remove WordPress RSS Feed Links

The above code does not remove the RSS feed links from your WordPress website. To remove RSS feed links from the website header copy and paste the following code into your functions.php file.

remove_action('wp_head', 'feed_links', 2 );
remove_action('wp_head', 'feed_links_extra', 3 );

These steps make your WordPress website run faster and more securely, giving visitors a better experience.

Leave a Reply

Your email address will not be published. Required fields are marked *