Disable RSS feeds on your WordPress blog
Disabling RSS feeds on public blogs is not something many people do. RSS feeds allow your subscribers to easily obtain updates of your blog’s latest posts from their favourite feed reader. Visitors like great content and getting it to them in efficient manner improves your website’s popularity. So why would anyone want to disable RSS feeds? If you have a private WordPress blog with information that your subscribers should not be publishing via RSS, then disabling feeds altogether is one option. Here is how to do it with functions.php. This post does not address protecting your RSS feed.
Locate your theme’s functions.php file in a simple text editor and append with the following lines.
// Disable all RSS feeds
function disable_our_feeds() {
wp_die( __('<strong>ERROR:</strong> We are sorry, but RSS feeds have been disabled on this website for privacy purposes. Please click <a href="http://mydomain.tld/" >this link</a> to return to the homepage.') );
}
add_action('do_feed', 'disable_our_feeds', 1);
add_action('do_feed_rdf', 'disable_our_feeds', 1);
add_action('do_feed_rss', 'disable_our_feeds', 1);
add_action('do_feed_rss2', 'disable_our_feeds', 1);
add_action('do_feed_atom', 'disable_our_feeds', 1);
Because you are editing the functions.php file, this modification needs to be applied to each WordPress theme for which disabling RSS feeds is required.
This modification does not automatically remove RSS feed links within your theme, so manually removing them from your page/post templates might be necessary if you want to be thorough.
Finally, should you prefer to retain feed access, but restrict to subscribers only, take a look at the Feed Key plugin.
