How to Disable RSS Feeds in WordPress

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.

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/

By default, there is no option to remove RSS feeds in WordPress. In this article, we will show you how to disable RSS feeds in WordPress.

Method 1: Disable RSS Feeds Using a Plugin

This method is easier and is recommended for beginners.

First thing you need to do is install and activate the Disable Feeds plugin.

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.disablefeedssettings

By default, the plugin will try to redirect users to related content on your site when they request a feed. For example, users requesting a category feed will be redirected to category page. Users trying to access custom post type RSS feed will be redirected to the custom post type archive.

You can change this behavior and show users a 404 error page.

You can also select not to disable the global RSS feed and comments feed. This will allow users to still subscribe to your RSS feed, but there will be no individual category, author, or post comment feeds.

Don’t forget to click on the save changes button to store your settings.

Method 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

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

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 );
Drop Your Comments Below

Leave a Reply