Free Wordpress Blog Setup

How to Disable RSS Feeds in WordPress

By Editorial Staff in Tutorials
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

Free Wordpress Blog Setup

Comments

2 Responses to “How to Disable RSS Feeds in WordPress”
  1. 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?

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

Share Your Opinions

Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!

Please make sure that you have read our Comment Policy.

Due to high volume of request from our readers, we are adding this feature that allows you to stay updated with this post's comments without having to participate in the discussion even though we would love your input as always. Don't worry we hate SPAM just as much as you do, so you will never receive any SPAM messages from our site and that's our promise to you.

Subscribe without commenting

Close Bar