Wordpress Disable RSS Feed

by Vivek Gite · 14 comments

Some webmasters and small business owners use wordpress as CMS. They do not need any sort of RSS feed. This is also good for security and private space blogs. You can easily disable all RSS feed.

Click on Appearance > Themes > Theme Editor > Locate and edit your functions.php.

Fig.01: Wordpress Themes Editor

Fig.01: Wordpress Themes Editor

Append following php code:

/**
 * Disable Our Feed Urls
 */
function disable_our_feeds() {
	wp_die( __('<strong>Error:</strong> No RSS Feed Available, Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>.') );
}
 
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);

Save the changes.

{ 13 comments… read them below or add one }

1 Adrian December 16, 2008 at 2:44 pm

Great!! It worked! :D

no more RSS feed :D

Reply

2 Kyle May 17, 2009 at 2:20 am

Thanks a lot! This worked great.

Reply

3 Preeti July 7, 2009 at 2:06 pm

It works !! Thanks a ton !

For novices like me the complete code with php tags is :

Reply

4 manu July 8, 2009 at 1:08 pm

this is nice but the rss icon in the url (firefox) is still there. Why ?

Reply

5 Miles Reetz September 10, 2009 at 10:51 am

Manu’s issue is the same as mine….the RSS icon needs to go away somehow also….any suggestions?

Reply

6 Babak October 11, 2009 at 8:00 am

in your header.php remove meta tags related to rss feed and the icon will be removed….

Reply

7 Dennis October 21, 2009 at 5:47 pm

Unfortunately /feed/rss will still work, so this is no solution.

Reply

8 Mario August 8, 2010 at 1:06 am

I agree, this is a wast of time: it does not work!!!!

Reply

9 Max December 1, 2009 at 10:10 pm

Try this:

create a directory called “feed” in your wordpress root and upload a blank index page (e.g. index.html or index.php etc.). RSS links from WP will display a wonderful white page instead of rss file.

Reply

10 Vario December 7, 2009 at 6:21 pm

great tip! YAY! thanks!

Reply

11 Jon January 20, 2010 at 10:31 pm

Instead of the wp_die, I use wp_redirect(get_option(’siteurl’)); which just sends them back to the homepage. I also disable rss from the head by removing it from the template altogether. Combined these remove the icon and the actual feed url from working at all.

Reply

12 חננה March 29, 2010 at 2:41 pm

Thanks for a neat, clean solution!

Reply

13 czar August 3, 2010 at 5:26 pm

Any idea how this can be used to OVERWRITE the template being used e.g. for RSS2? I don’t want to change the core files, but it seems like there is no other way…

Reply

Previous post:

Next post: