how to easily disable all RSS feeds in wordpress websites and blogs

WordPress is one of the most popular Content Management System (CMS) used to develop websites and blogs. The news or rss feeds are an integral part of the WordPress platform and is enabled by default for websites and blogs. There are usually times when you do not want one, many or all of those feeds enabled.

WordPress does not provide an easy mechanism to disable these feeds. You basically will have to modify the core files to change or disable these feeds. But there is an easier way to do it by using just functions and WordPress filters. The advantage being that you will not have to change your core files everytime the wordpress is updated or upgraded.

As WordPress provides you with quite a few number of feeds ranging from an all-site feed to a post specific comments feed, you might have the need to just disable just some of those feeds depending on your website or blog.

In order to do it first locate the functions.php file in your theme folder. Open this file and include any of the following code in it depending on your requirements.

Disable Comments Feed

This will remove all the comment feeds for all your blog posts.

function remove_comments_feed ($link) {
return;
}
add_filter('post_comments_feed_link', 'remove_comments_feed');

Disable Author Feed

This will disable feeds which are specific to an author. If you are the only author of your blog or if you do not wish provide a author specific feed, then use the following code.

function remove_author_feed ($link) {
return;
}
add_filter('author_feed_link', 'remove_author_feed');

Disable Search Results Feeds

There is also a search feed which allows the users to search your blog and then subscribe to a feed of the search results. You can remove this by adding the following to the functions.php
function remove_search_feed ($link) {
return;
}
add_filter('search_feed_link', 'remove_search_feed');

Disable All News Feeds

The above code is useful if you would like to selectively remove some or more of the feeds. If you like to disable all RSS feeds for your blog or website, then you could use the following code instead of having to disable each one separately.

There are also some plugins available that will disable all RSS feeds. If you prefer to do that rather than mess around with php source files, then do a search for “disable rss” in the wordpress plugins page to find them.

function disable_all_feeds () {
wp_die( __('There are no feeds available for our website. 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_atom', 'disable_all_feeds', 1);
add_action('do_feed_rss', 'disable_all_feeds', 1);
add_action('do_feed_rss2', 'disable_all_feeds', 1);

All of the above code are working with WordPress version 3.2.1. It is quite possible that future version may change and these maynot work correctly. So, check your wordpress version before modifying. Check out the post my other post if you are looking to disable category or tag posts.