How to Disable WordPress RSS feed

Disable WordPress Feed

Last update:

Sometimes it is interesting to turn odf the RSS feeds or WordPress syndication links.

In this post we will show you, step by step, the most efficient way to disable WordPress RSS feeds.

Table of Contents

Why disable WordPress RSS feed?

Some usual reasons are:

  • To avoid automated copying and its indexing and subsequent penalty for duplicate content.
  • To eliminate a potential weak point prone to receive attacks (hacking)
  • Because we only want users to access the content via the web, as would be the case with e-commerce sites.

Some robots (scrappers) are dedicated to accessing WordPress feeds to copy its content, full automatic.

If Google indexes your content later than your copycat, it can be detrimental for your SEO efforts.

Avoid automated plagiarism by scrapping robots. Keep YOUR content indexed at its best and original location: YOUR website.

Do I need to install a plugin to remove WordPress feeds?

There are several WordPress plugins to disable RSS feeds in WordPress. But given the simplicity of the process, we suggest you turn feeds off via code.

Keeping it simple has a weight in WP. We cannot stress further on performance and security, as important reasons to disable WordPress RSS feed. If you care about speed and security as much as we do, keep your WordPress with the minimum number of active extensions.

Thus, code as much as you can afford: our mission beyond managed hosting is to guide you to easy and safe hacks to gain control over your WP install. The less parts, the more stable, secure and reliable your site is.

At wetopi, being a WordPress Managed Hosting, we are focused in performance and Security for WordPress.

To let you follow the process of disabling WordPress RSS feed without breaking your production website, we give you a free dedicated development server.

If you don’t have a development WordPress server, signup at wetopi, it’s FREE.

Remove WordPress feed content via code

First of all you have to locate your child theme’s functions.php file. This is the only file you’ll need to edit to disable the feeds.

One way to access and edit the configuration files is by connecting to the server by sftp (Secure FTP).

The code to disable WordPress RSS feed

function disable_all_feeds() {
   wp_die(__('This WordPress does not have Feeds.'));
}
 
add_action('do_feed', 'disable_all_feeds', 1);

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

With this first block of code, you will disable all the feed formats that WordPress provides. With this simple piece of code, when a user or crawler wants to load your WordPress feed e.g. https://yoursite.com/feed, it will get a HTTP500 error with the message: “This WordPress does not have Feeds.”

The previous code removed the content from the feeds, but WordPress continues to add links to the RSS feeds in your page headers.

html links to WordPress RSS feeds
Headers linking to WordPress Feeds

To remove the feed links, you have to add the following code in functions.php:

remove_action('wp_head', 'feed_links', 2 );
remove_action('wp_head', 'feed_links_extra', 3 );

We are techies passionate about WordPress. With wetopi, a Managed WordPress Hosting, we want to minimize the friction that every professional faces when working and hosting WordPress projects.

Not a wetopi user?

Free full performance servers for your development and test.
No credit card required.

See how Wetopi stacks up against your current hosting

Migrating sites to us is free and completely effortless on your part.

No hidden small text.
No commitments.
No credit card.

Try before you buy.