WordPress is a powerful content management system that allows you to easily create and manage a website. It also includes a feature that allows you to disable the RSS feed for your website. Disabling the RSS feed can help you control the content that is shared on your website and protect your content from being used without your permission. In this article, we will show you how to disable the RSS feed in WordPress.
1. Log in to your WordPress dashboard.
2. Go to Settings > Reading.
3. Under the “Syndication Feeds” section, uncheck the box next to “Allow link notifications from other blogs (pingbacks and trackbacks).”
4. Click the “Save Changes” button.
5. Go to Settings > Discussion.
6. Under the “Default Article Settings” section, uncheck the box next to “Allow link notifications from other blogs (pingbacks and trackbacks).”
7. Click the “Save Changes” button.
8. Go to Appearance > Editor.
9. On the right side of the page, click on the “Theme Functions (functions.php)” file.
10. Add the following code to the bottom of the file:
function disable_all_feeds() {
wp_die( __(‘No feed available,please visit our homepage!’) );
}
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);
11. Click the “Update File” button.
Your RSS feed is now disabled and visitors will be redirected to your homepage when they try to access it.
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/
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 Everything. This plugin disables all RSS/Atom feeds and feed links on your WordPress website by redirecting all the requests.
You can download Disable Everything from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. Once the plugin has been installed and activated, simply head over to the Disable Everything “settings” area and check the checkbox to disable all RSS feeds and feed links.
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.
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.
Before you get started, create a backup and use a child theme, so you won’t lose your changes if you update your theme. Then, copy the following code into your child 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.
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.
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 );
Get all your applications, databases and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:
- Easy setup and management in the MyKinsta dashboard
- 24/7 expert support
- The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
- An enterprise-level Cloudflare integration for speed and security
- Global audience reach with up to 35 data centers and 275 PoPs worldwide
Get started with a free trial of our Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.