Disabling RSS Feeds in Wordpress

Disabling RSS in Wordpress

Sometimes, if you’re using Wordpress as a content management system (CMS), you don’t want to enable RSS feeds. For example, if you’re running a corporate website, an informational site, or any other kind of website that doesn’t need to have RSS, then its worth disabling RSS on your Wordpress site. After some digging around, I’ve found some tricks that allow you to disable RSS feeds.

I haven’t yet found a (non hacky) way to remove the RSS entry in the <head> tags, but when I do, I’ll update this article.

Updating your template functions.php

In your template code, if you copy and paste the following code into the functions.php file, users will get a message saying that RSS feeds have been removed.

function disable_our_feeds() {
   wp_die( __('Error: No RSS Feed Available,
   Please visit our <a href="'. get_bloginfo('url') .'">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);

Updating .htaccess

To stop users reaching the RSS page in the first place, you can redirect domain.com/feed back to domain.com using your apache .htaccess file.

# Remove RSS feed

RewriteEngine On
RewriteBase /
RewriteRule feed(.*) http://www.yourwebsite.co.uk/ [L]

Doing it with a plugin

The code changes above should only be done if you know what you’re doing. If you still want to disable RSS feeds, but you’re not that comfortable editing code, then I suggest using the Disable RSS plugin to do it.

Need some custom Wordpress plugins developed? Need some tweaks to your Wordpress theme? Hire Dan for your Custom Wordpress Development Work.

6 Responses to “Disabling RSS Feeds in Wordpress”

  • I’ve not had a need for this yet, though for some people I would think it could be quite useful.

    It may be worth submitting this to WPRecipes.com (http://www.wprecipes.com/contribute) they have over 4100 RSS subscribers and may bring you some traffic.

  • Dan Harrison says:

    Thanks for the tip Darren, that’s a great WP site to read!

  • Hi Dan,

    now that is a great tip but I can’t see why even corporate websites wouldn’t want to have RSS. I mean even larger websites can benefit from using RSS so don’t you find that it would be more valuable to fit RSS into the strategy instead of just removing it?

  • Dan Harrison says:

    Generally, RSS is useful. However, sometimes I just don’t want the hassle of setting up a RSS feed… especially for a mini site.

    Dan

  • Dana says:

    I am tired of people scraping my feed and coming up in search engines before me for content I wrote.

    I am glad I found this option.

    I noticed one draw back though- my content no longer shows up in Google’s blog search.

  • Dan Harrison says:

    Hi Dana,

    If your content is getting scraped, I suggest using the wordpress plugin WP Footer by Yoast, which means you can at least get a backlink to your website. It’s worth being in the blog search for the extra traffic.

    Dan

Leave a Reply

Find out why I recommend Artisteer for creating Wordpress Themes.

Artisteer - Wordpress Theme Generator
Previous Articles