Falcon1986-Online

Home of a med student who likes to manage websites and talk tech!

Disable RSS feeds on your WordPress blog

leave a comment »

WordPress LogoDisabling RSS feeds on public blogs is not something many people do. RSS feeds allow your subscribers to easily obtain updates of your blog’s latest posts from their favourite feed reader. Visitors like great content and getting it to them in efficient manner improves your website’s popularity. So why would anyone want to disable RSS feeds? If you have a private WordPress blog with information that your subscribers should not be publishing via RSS, then disabling feeds altogether is one option. Here is how to do it with functions.php. This post does not address protecting your RSS feed.

Locate your theme’s functions.php file in a simple text editor and append with the following lines.

// Disable all RSS feeds
function disable_our_feeds() {
	wp_die( __('<strong>ERROR:</strong> We are sorry, but RSS feeds have been disabled on this website for privacy purposes. Please click <a href="http://mydomain.tld/" >this link</a> to return to the homepage.') );
}
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);

Because you are editing the functions.php file, this modification needs to be applied to each WordPress theme for which disabling RSS feeds is required.

This modification does not automatically remove RSS feed links within your theme, so manually removing them from your page/post templates might be necessary if you want to be thorough.

Finally, should you prefer to retain feed access, but restrict to subscribers only, take a look at the Feed Key plugin.

Advertisements

Written by falcon1986

27 February, 2011 at 11:04 AM

Posted in Wordpress

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: