How to disable RSS feeds on your WordPress blog

October 25, 2012 at 4:17 pm

WordPress built-in RSS feeds are definitely cool. But if you’re using WordPress to create a simple website, you may do not need the feeds at all. So what about disabling them? Here’s a simple and clean way to do it.

Paste the code below into your functions.php file. RSS feeds will not be available anymore after you saved the file.

unction digwp_disable_feed() {
	wp_die(__('<h1>Feed not available, please visit our <a href="'.get_bloginfo('url').'">Home Page</a>!</h1>'));
}
add_action('do_feed',      'digwp_disable_feed', 1);
add_action('do_feed_rdf',  'digwp_disable_feed', 1);
add_action('do_feed_rss',  'digwp_disable_feed', 1);
add_action('do_feed_rss2', 'digwp_disable_feed', 1);
add_action('do_feed_atom', 'digwp_disable_feed', 1);

Thanks to Jeff Starr for the cool tip!

Tags: