How to Disable WordPress RSS Feed

WordPress is a popular blogging platform used by millions of websites globally. I personally use WordPress for publishing my blogs and other websites. WordPress also supports the RSS feed and allows users to subscribe to notifications for all the latest updates. Your blog readers can subscribe to get emails for fresh content. But, WordPress RSS Feed is not good for all kinds of websites. So, there can be a few reasons why a person can think of disabling the WordPress Feed. If you want to know how to disable the RSS Feed in WordPress, keep reading. In this article, I will tell you two different ways to disable WordPress RSS Feed.
Also Read: WordPress.org vs WordPress.com
Best Managed WordPress Hosting
WPEngine is the best and most secure managed hosting providerBy default, WordPress generates all kinds of RSS feeds. The link format is below.
https://thewpguides.com/feed/ https://thewpguides.com/feed/rss/ https://thewpguides.com/feed/rss2/ https://thewpguides.com/feed/rdf/ https://thewpguides.com/feed/atom/
Along with these feeds, WordPress also generates RSS feeds for categories and tags.
WordPress Disable RSS Feed
You can disable the WordPress RSS feed either by using the plugin or code. In this article, I will explain both ways.
- Disable RSS Feed with Plugin
- Disable RSS Feed with Code
Disable RSS Feed with Plugin
The easiest way is to use the Plugin and disable the RSS feed. Install Disable Feeds Plugin on your WordPress-based website. This plugin disables all RSS/Atom feeds of your WordPress website. It also disables BuddyPress group feeds and bbPress forum feeds if you are using any of these.
By default, it redirects the feed request to the corresponding HTML page. For example, if you request for category feed, it will redirect to the category archive page. You can change this setting from Settings -> Reading. You will see the new section saying Disable Feeds Plugin.
Disable RSS Feed with Code
If you know how to code and are comfortable with changing the code, you can try this way. If you do anything wrong, it will show the White screen in place of your website. So, do it only if you know how to do it.
Now open the functions.php file and add the following code.
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);
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
When someone tries to access the feed after adding this code, he will see the message, “No feed available, please visit the homepage.” You can change the message in the above code if you want to show a different message. The above code will also remove the feed links from the header.
Final Words
The feed is an important part of WordPress. If you are using it for the blog, the feed is important for you. But, there can be many kinds of websites where you do not wish to allow other people to know when you are updating your website. In those cases, you can disable the RSS feed of your WordPress website.
I have explained both ways to disable the RSS feed. You can use any of the given ways. Do not forget to share your views on this.
Leave a comment
Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.