WordPress Disable RSS Feed

by admin on December 14, 2008 · 27 comments

in Wordpress

Some webmasters and small business owners use WordPress as CMS. They may not need any sort of RSS feed. This is also good for security and private space blogs. You can easily disable all RSS feed by editing functions.php file. This file used to change the default behaviors of WordPress. It goes in your Theme's folder. A Child Theme can have its own functions.php.

The functions file behaves like a WordPress Plugin, adding features and functionality to a WordPress site. You can use it to call functions, both PHP and built-in WordPress, and to define your own functions. You can produce the same results by adding code to a WordPress Plugin or through the WordPress Theme functions file.

How do I edit functions.php?

Click on Appearance > Themes > Theme Editor > Locate and edit your functions.php. Beware: if you do not edit file properly the results can be unexpected -- even site-disabling. Make a backup of your exisiting file using ftp / sftp.

Fig.01: WordPress Themes Editor

Fig.01: WordPress Themes Editor

Make sure you add the following code between <?php ?> tags.

  1. /**
  2.  * Disable Our Feed Urls
  3.  */
  4. function disable_our_feeds() {
  5. wp_die( __('<strong>Error:</strong> No RSS Feed Available, Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>.') );
  6. }
  8. add_action('do_feed', 'disable_our_feeds', 1);
  9. add_action('do_feed_rdf', 'disable_our_feeds', 1);
  10. add_action('do_feed_rss', 'disable_our_feeds', 1);
  11. add_action('do_feed_rss2', 'disable_our_feeds', 1);
  12. add_action('do_feed_atom', 'disable_our_feeds', 1);

Save and close the file.

{ 26 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

2 Kyle May 17, 2009 at 2:20 am

Thanks a lot! This worked great.

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 :

4 manu July 8, 2009 at 1:08 pm

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

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?

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….

7 Dennis October 21, 2009 at 5:47 pm

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

8 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.

9 Vario December 7, 2009 at 6:21 pm

great tip! YAY! thanks!

10 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.

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

Thanks for a neat, clean solution!

12 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…

13 Mario August 8, 2010 at 1:06 am

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

14 Riversatile September 15, 2010 at 4:56 pm

Many Thanks, because SPAM robots were posting SPAM using my RSS FEEDS !

15 minimarket October 18, 2010 at 6:59 am

We find another way:
insert into .htaccess before wordpress rewrite rule
2 line:
RewriteRule feed – [G,L]
ErrorDocument 410 /410.html

and adding in root dirrectory (where wp-config.php) file 410.html with your content.
Thats all. Fully working mechanism.
Warning – Working only with pretty permalink!!!

16 Jodie Oliver December 9, 2010 at 1:10 am

HELP!! I embedded this code and now i only get a bunch of errors and cannot get back to my edit page on wordpress???

17 UtahRugbyGuy February 11, 2011 at 4:00 pm

Ugh! I tried this and all it did was add a bunch of jibberish text at the top of my page where the normal WordPress header goes and it didn’t remove the RSS feed logo, which is all I wanted to do because I don’t need that. Admittedly, I’m a graphic designer, not a programmer. I can always have my web guy edit it because he has admin access …but it’d be easier if I just knew how it worked :) Thanks!

18 George February 12, 2011 at 6:27 pm

Tnx dude, this worked perfect.

You have to put the code before the function get_feed from the top. Save the file like that and add it back on your server. You can add what message you want to show like a “error” ! :)

19 Josh March 16, 2011 at 8:37 am

Thanks for the information. Problem solved.

20 hawken September 28, 2011 at 9:10 pm


I edited this code and I can’t even access my wp-admin now…..? Where do I go from now?

21 Ben November 9, 2011 at 1:01 pm

Just one question:
Even if you’re a webmaster of a small site or use wordpress as a CMS. Why the h* would you want to disable your rss-feed? It allows easily staying in touch with your site/news. If you want your readers to go to your page, use excerpts (the more-tag).

Also, most of the proposed workarounds are probably lost after an upgrade. And you really do need wordpress-updates eg. because of security issues.

Better use a plugin which handles this: https://wordpress.org/extend/plugins/search.php?q=disable+rss+feed&sort=
Still, I see no reasonable reason to do so.

22 Sam December 22, 2011 at 11:12 pm

Worked for me, thanks!

23 Just March 24, 2012 at 11:59 pm
 * Disable Our Feed Urls
function disable_our_feeds() {
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);
24 Ryan Nagy June 8, 2012 at 2:24 am

When I do this my blog disappears! Very strange.

25 Nashua Indigo July 20, 2012 at 12:37 pm

“/feed/rss will still work”

That is NOT true, if you do it good, none of your feeds will work!
So yes the script works

26 sabrx September 5, 2012 at 3:11 pm

Hello, first of all thanks for the solution, it worked great for me!

To those who didn’t manage to use the procedure (Wordpress got messed up with code after modifying functions.php), make sure you put the code into tags, else it won’t be recognized as php code, therefore shown on screen as text. It also happened to me firstly :-)

Previous post:

Next post: