Disabling RSS in WordPress

In some instances, it is desirable to disable generation of RSS feeds by WordPress.  Akuna Matata presents a simple solution to this problem.  Just add the following to your theme’s functions.php:

/**
 * Disable Our Feed Urls
 */
function disable_our_feeds() {
	wp_die( __('<strong>Error:</strong>' . 
		'No RSS Feed Available, ' . 
		'Please visit our <a href="'. 
		get_bloginfo('url') . 
		'">homepage</a>.'));
}

add_action('do_feed', 'disable_our_feeds', 1);
add_action('do_feed_rdf', 'disable_our_feeds', 1);
add_action('do_feed_rss', 'disable_our_feeds', 1);
add_action('do_feed_rss2', 'disable_our_feeds', 1);
add_action('do_feed_atom', 'disable_our_feeds', 1);

Leave a Reply

Your email address will not be published. Required fields are marked *