How To Disable RSS Feeds In WordPress

By default, there is no option to disable RSS feeds in WordPress, because RSS feeds allow users to subscribe to your blog posts. However, there are certain situations where you may want to turn off RSS feeds. There are a few plugins that you can use to do this, but whenever possible we always try to use as few plugins as possible and use our own code.

UNLIMITED DOWNLOADS: 500,000+ WordPress & Design Assets

Sign up for Envato Elements and get unlimited downloads starting at only $16.50 per month!




 

By placing the following code in your theme’s functions.php file (or a site-specific plugin) when someone tries to go to the RSS feed link (yoursite.com/feed/) they will receive a message that no feed is available.

function 1wd_disable_feed() {
wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
}

add_action('do_feed', '1wd_disable_feed', 1);
add_action('do_feed_rdf', '1wd_disable_feed', 1);
add_action('do_feed_rss', '1wd_disable_feed', 1);
add_action('do_feed_rss2', '1wd_disable_feed', 1);
add_action('do_feed_atom', '1wd_disable_feed', 1);
add_action('do_feed_rss2_comments', '1wd_disable_feed', 1);
add_action('do_feed_atom_comments', '1wd_disable_feed', 1);

Now you know how to disable RSS feeds in WordPress. Be sure to check out our other WordPress tutorials for more tips!