How to disable RSS feeds in WordPress ?

WordPress automatically generates multiple RSS feed URLs for your posts, comments, categories, and authors.
But if you’re not using them — or want to stop content scrapers from stealing your posts — you can disable RSS feeds completely without using any plugin.

This helps improve security, server performance, and prevents unwanted bots from auto-fetching your content.

Step 1. Create a child theme

If you have not created a child theme yet then first create a child theme

Visit to know : How to create child theme in WordPress

If you have already created a child theme then ignore step 1.

Step 2. Add following PHP code snippet to functions.php of your child theme.

// Disable all RSS feeds
function disable_all_feeds() {
    wp_die( __('RSS feeds are disabled on this site. Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
}
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);

What this does:

  • Blocks access to all RSS, Atom, and RDF feeds
  • Displays a friendly message directing users back to your homepage
  • Works site-wide — posts, categories, comments, everything

Step 3 : Disable Feed Links in the <head> Section

Even after disabling feeds, WordPress still includes <link> tags to RSS in your site header.
Remove them with this snippet, just add it below above code.

// Remove feed links from head
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'feed_links_extra', 3);

Now your site will no longer display or advertise any feed URLs.

Step 4: To Redirect Feed URLs to Homepage (Optional) just add this snippet in functions.php of your child theme.

function redirect_all_feeds_to_home() {
    wp_redirect(home_url());
    exit;
}
add_action('do_feed', 'redirect_all_feeds_to_home', 1);
add_action('do_feed_rdf', 'redirect_all_feeds_to_home', 1);
add_action('do_feed_rss', 'redirect_all_feeds_to_home', 1);
add_action('do_feed_rss2', 'redirect_all_feeds_to_home', 1);
add_action('do_feed_atom', 'redirect_all_feeds_to_home', 1);
add_action('do_feed_rss2_comments', 'redirect_all_feeds_to_home', 1);
add_action('do_feed_atom_comments', 'redirect_all_feeds_to_home', 1);

Now Test Your Changes :

Open your browser and visit

yoursite.com/feed/
yoursite.com/comments/feed/

  • You should now see either:
    • A message (“RSS feeds are disabled…”), or
    • A redirect to your homepage (if you used the redirect method)

Why Disable Feeds ?

  • Prevents content scrapers from auto-copying your posts
  • Slightly improves load time by reducing unnecessary feed generation
  • Cleaner site structure if you don’t use RSS-based tools

Leave a Reply

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