How to Disable WordPress RSS Feeds

Do you still want to keep the RSS feeds on in your WordPress installation? RSS feeds are the old thing now. RSS feeds are the cool things of the past. Now its social media feeds, walls and pages. Google discontinued its feed reader Google Reader long back. So, if you landed here with intention to learn how to disable RSS feeds in your WordPress site, I will show you a way in this article.

Please do not right way jump into loading a WordPress plugin in to your installation. Over a period it will bloat your setup. You need to be always careful when opting to go for a WordPress plugin installation. Most of the times, when you choose one, then it will be tied around your neck for years to come. If you know minimal programming, then that should be sufficient to get things done most of the times yourself. Moreover, it is always good and great feeling when you get things done by yourself.

How to disable the feeds?

You need to edit functions.php file from your WordPress theme. All you need to do is simple,

  1. From your WordPress theme, download and open functions.php file in a text editor
  2. Paste the below given code snippet in it and upload the file back.
function wp_disable_feeds() {
wp_die( __('No feeds available!') );
}
 
add_action('do_feed', 'wp_disable_feeds', 1);
add_action('do_feed_rdf', 'wp_disable_feeds', 1);
add_action('do_feed_rss', 'wp_disable_feeds', 1);
add_action('do_feed_rss2', 'wp_disable_feeds', 1);
add_action('do_feed_atom', 'wp_disable_feeds', 1);
add_action('do_feed_rss2_comments', 'wp_disable_feeds', 1);
add_action('do_feed_atom_comments', 'wp_disable_feeds', 1);

If you are not aware of add_action method in WordPress, it just hooks a function to an action. Here whenever various feeds are requested, we just return the text ‘No feeds available!’.

Its that simple, tada!

This WordPress code tutorial was published on May 15, 2018.

↑ Back to Top