How To Disable RSS Feeds In WordPress

Original Source: http://feedproxy.google.com/~r/1stwebdesigner/~3/NuxEAcaa3Tc/

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!

DOWNLOAD NOW

 

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!


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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