WordPress Disable RSS Feed

Updated on March 08, 2018
73
Shares

WordPress is primarily known by people for its powerful blogging features. RSS Feeds are used by people to subscribe to your new content that you post and also to feed into third-party reader applications such as Feedly. This way they can read your fresh content on the go. However, not everyone uses the blogging portion of WordPress and for some businesses, in fact, might simply want to in WordPress disable RSS feeds altogether. This is then one less thing they have to worry about.

wordpress disable rss

By default WordPress generates all kinds of RSS feeds that are built in, such as:

http://example.com/feed/
http://example.com/feed/rss/
http://example.com/feed/rss2/
http://example.com/feed/rdf/
http://example.com/feed/atom/

It also generates them for your categories, tags, comments, etc.

WordPress Disable RSS Feed

There are a couple different ways to disable RSS feeds in WordPress. You can do it with a plugin or with code.

1. Disable RSS Feed with Plugin

The first way to disable a WordPress RSS feed is to use a free plugin like Disable Feeds. This plugin disables all RSS/Atom feeds on your WordPress website by redirecting all the requests. It also disables BuddyPress group feeds and bbPress forum feeds. It was actually created by the same developer that made the Disable Comments plugin as discussed in our other article. It is actively maintained and currently has over 20,000 active installs with a 4.9 out of 5 rating.

You can download Disable Feeds from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. You can then change the settings under the “Reading” section in settings. By default, the plugin will redirect the request to its corresponding HTML content. For example, if a visitor hits a category RSS feed they will be directed to the category archive page. You can also choose to simply show a 404 error instead and whether or not to disable the global post feed and global comment feed.

wordpress disable rss feed plugin

Disable RSS feed plugin

Note: The plugin only disables the feeds themselves, you will still need to remove the links to your RSS feeds yourself within your WordPress theme or corresponding sidebar and footer widgets.

You could also use a premium plugin like perfmatters (developed by a team member at Kinsta), which allows you to both disable RSS feeds and disable RSS feed links, along with other optimizations for your WordPress site.

Disable RSS feeds with perfmatters

Disable RSS feeds with perfmatters

2. Disable RSS Feed with Code

The second method to disable a WordPress RSS feed is to simply use code.

Important! Editing the source code of a WordPress theme could break your site if not done correctly. If you are not comfortable doing this, please check with a developer first.

Copy the following code into your WordPress theme’s functions.php file.

function itsme_disable_feed() {
 wp_die( __( 'No feed available, please visit the <a href="'. esc_url( home_url( '/' ) ) .'">homepage</a>!' ) );
}

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

Now if a person visits an RSS feed on your site, domain.com/feed for example, they will see the following message.

rss feed disable warning

RSS feed warning

WordPress also generates links to the RSS feeds within your webpage’s header, as seen in the screen below. You can go one step further and remove these links from within your pages HTML code.

rss-feed wordpress header

RSS feed in WordPress header

Copy the following code into your functions.php file to remove the header links to your RSS feeds.

remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
Was this article helpful?
No, or there was something off

Hand-picked related articles

Use WordPress?

Use WordPress?

Join 20,000+ others who get our FREE weekly newsletter with WordPress tips on how to drive more traffic and revenue to your business!

Consent

You have Successfully Subscribed!

Send this to a friend