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 »

Comments

  1. Bridget says:

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

  2. ubaid says:

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

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

  3. Nouman Younas says:

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

  4. Will says:

    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?

  5. chandler says:

    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.

    • Editorial Staff says:

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

  6. josef says:

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

  7. Luke says:

    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);

  8. Vishesh Kachheda says:

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

  9. Toufiq says:

    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?

  10. languageweb says:

    worked a dream. Thanks!

  11. Olivia says:

    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!

  12. Kelly says:

    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

    • Editorial Staff says:

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

  13. Renato says:

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

  14. sherwinraavi says:

    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?

    • Editorial Staff says:

      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.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.