How to Disable RSS Feeds in WordPress

Here’s a handy PHP code snippet which allows you to disable RSS feeds in WordPress. This can be useful if you are using WordPress as content management system to build a corporate website which doesn’t have a blog.

Quick Tip : How to Allow User Log In with Email in WordPress

To disable RSS feeds copy the following lines of code and paste it inside your functions.php file located inside your themes folder.

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);

Source : wpengineer


Leave a Comment.