How to disable WordPress feed

Disable WordPress Feed

Sometimes it is interesting to disable RSS feeds or WordPress syndication links.

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

Table of Contents

Why disable WordPress feed?

Some reasons are usually: to avoid automated copying and its indexing and subsequent penalty for duplicate content, to eliminate a focus of attacks, or because we only want users to access the content via the web, as would be the case with e-commerce sites.

Some robots are dedicated to accessing the WordPress feed and copying the content in an automated way.

If Google indexes your content earlier, it can be very detrimental at the SEO level.

Avoid automatically content plagiarism through robots.

Do I have 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 disable feeds via code.

Another reason, no less important, is performance and security. If you care about speed and security as much as we do, keep your WordPress with the minimum number of active extensions.

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 feeds 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 tries to load your WordPress feed e.g. https://yoursite.com/feed, it will get a 500 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
Cabecera con los enlaces a los feed de WordPress

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.