Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Disable RSS Feeds in WordPress

Last updated on by
Elegant Themes
How to Disable RSS Feeds in WordPress

WordPress is one of the best Content Management System (CMS) available. There will be times that you will create a static website and does not want to implement RSS Feeds. But that feature is automatically included in WordPress and in order to turn it off, you would have to edit core files. But in this article we will show you how you can disable RSS Feeds without editing the core file by simply creating a function in WordPress.

Open your functions.php located within your themes folder and add the following code:

    function fb_disable_feed() {
    wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
    }

    add_action('do_feed', 'fb_disable_feed', 1);
    add_action('do_feed_rdf', 'fb_disable_feed', 1);
    add_action('do_feed_rss', 'fb_disable_feed', 1);
    add_action('do_feed_rss2', 'fb_disable_feed', 1);
    add_action('do_feed_atom', 'fb_disable_feed', 1);
    add_action('do_feed_rss2_comments', 'fb_disable_feed', 1);
    add_action('do_feed_atom_comments', 'fb_disable_feed', 1);

Once you add this code, anytime someone tries to reach your feeds, they will see this message: “No feed available, please visit our homepage.” You can change the message to fit your needs.

Source: Frank from WPEngineer


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • Bridget

    Question:
    Is it possible to disable rss feeds — for “non-members” of a site — but still allow members to use them?

  • ubaid

    I used this code. But didn’t work. Any suggestions for me?

    I have placed the code correctly around php tags inside functions.php

  • Nouman Younas

    I was searching for this, but i have a question..
    why websites disable feeds? what are the reasosn to take such step?

  • Will

    Do you know if it’s possible to remove just Tag and Category Feeds from a WP install that has the Atahualpa Theme?

    I think 1 Main RSS feed is enough.

    I don’t have users asking for anything more specific, and the software publishing it the way it does seems overkill and dilutionary.

    Any ideas?

  • chandler

    Hi,
    I copied and pasted this. When I clicked enter it took me to a 500 error.
    I can no longer access my site.

    I’m not the server admin, and not sure how to manually access the functions.php file.

    Please help.

    • http://www.wpbeginner.com Editorial Staff

      Are you sure that you pasted this in the right functions.php file which is located in your themes folder?

  • josef

    hi thanks!
    can i blok feed&rss… for costume post type only?

  • Luke

    I would also add following code in order to hide feeds also for comments

    add_action(‘do_feed_rss2_comments’, ‘fb_disable_feed’, 1);
    add_action(‘do_feed_atom_comments’, ‘fb_disable_feed’, 1);

    • http://www.wpbeginner.com Editorial Staff

      Thanks Luke. Just updated the article.

  • Vishesh Kachheda

    Thanks A Lot for This Post, I Really Needed This!!

  • Toufiq

    I have done it! and obviously it works, but the problem is i have started to get crawl errors on google webmaster with 500 response, any help in this issue?

    • http://www.wpbeginner.com Editorial Staff

      Not sure why the feed would cause 500 errors. This sounds like a different issue.

  • languageweb

    worked a dream. Thanks!

  • http://www.olivia-engelen.de Olivia

    This question might be weird :) but i actually have this perfectly working with your few lines of code in the functions.php – means RSS is disabled. Now i want to enable RSS again – and i thought i just delete the lines and upload functions.php and that’s it – but RSS feed seems still to be disabled. Any ideas what i did wrong? thanks heaps!

  • Kelly

    Thanks for this tip. Does it still work with wordress 3.0? I just tried it and got some error messages. Perhaps I didn’t place the function on the right line of the theme functions.php?

    Kelly

    • http://www.wpbeginner.com Editorial Staff

      It should still work with 3.0. Make sure that code is placed within the php tags and is not in another function.

  • http://urbanidades.arq.br Renato

    Wow. You saved my life twice today!
    Thanks again!

  • http://www.twitter.com/sherwinraavi sherwinraavi

    What if I’m using wordpress as a cms but with a blog component? Can you turn on RSS for the blog but turn it off for the rest of the site?

    • http://www.wpbeginner.com Editorial Staff

      Don’t know how that would be possible unless you are running two separate installs of WordPress. Because all you have different if you are using as a CMS is pages and your pages do not show up in RSS anyways.