Disable all WordPress feeds

WordPress is often used to create websites which do not need feeds (RSS feeds, atom feeds, etc). Sometimes we just want to mimic a HTML website. You can disable the feeds functionality of WordPress by pasting the following code in the functions.php file of your WordPress theme. It will add a notice along with a link to the homepage if someone visits the default feed URLs. Use this function only if you are sure that you want to disable the feeds in your WordPress site!

// disable all feeds
function fb_disable_feed() {
	wp_die(__('<h1>Feed not available. Please visit our <a href="'.get_bloginfo('url').'">Home Page</a>!</h1>'));
}
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);

This function will completely disable all of your website’s feeds, including all different formats such as feeds for comments.

Source: WP Engineer

3 Replies to “Disable all WordPress feeds”

    1. Hey Toufiq, The tutorial is about removing the RSS feeds. So it is a desired outcome of the code. You should be getting an error message from WordPress. If you want to get your RSS feed back, just delete the code snippet from functions.php. Thanks

Comments are closed.