How to Disable RSS Feeds in WordPress

Posted on November 3rd, 2009 by in Tutorials | 10 Comments  
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);

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

About

Editorial Staff at WPBeginner mainly Syed and David.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest

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!

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

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

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

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?

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.

Tweets about us: