WordPress tutorials: Disable all feeds

Wpsnipp – 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.

Adding this to your functions.php of your wordpress theme will disable all wordpress feeds.




function disableFeed() {
wp_die(__('<h1>This feed is not available, please visit our <a href="'.get_bloginfo('url').'">Home Page</a>!</h1>'));
add_action('do_feed',      'disableFeed', 1);
add_action('do_feed_rdf',  'disableFeed', 1);
add_action('do_feed_rss',  'disableFeed', 1);
add_action('do_feed_rss2', 'disableFeed', 1);
add_action('do_feed_atom', 'disableFeed', 1);

Leave a comment