To disable RSS feeds in WordPress, you can use one of the following methods:
Method 1: Manually Disable RSS Feeds
If you prefer not to use a plugin, you can disable RSS feeds manually by adding code to your theme’s functions.php file.
- Log in to your WordPress site.
- Go to “Appearance” and click on “Theme Editor”.
- Locate and click on “functions.php” on the right-hand side.
- Add the following code at the end of the file:
- Click on the “Update File” button to save the changes.
// Disable Feed function wpr_disable_all_feeds() { // Disable RSS and Atom feeds add_action('do_feed', 'wpr_disable_all_feeds_action', 1); add_action('do_feed_rdf', 'wpr_disable_all_feeds_action', 1); add_action('do_feed_rss', 'wpr_disable_all_feeds_action', 1); add_action('do_feed_rss2', 'wpr_disable_all_feeds_action', 1); add_action('do_feed_atom', 'wpr_disable_all_feeds_action', 1); // Disable XMLRPC add_filter('xmlrpc_enabled', '__return_false'); // Remove feed links from the head remove_action('wp_head', 'feed_links', 2); remove_action('wp_head', 'feed_links_extra', 3); } function wpr_disable_all_feeds_action() { wp_die('No feed available, please visit the <a href="' . esc_url(home_url('/')) . '">homepage</a>.'); } add_action('init', 'wpr_disable_all_feeds');
Method 2: Using a Plugin
- Log in to your WordPress admin dashboard.
- Go to “Plugins” and click on “Add New”.
- Search for the “Disable Feeds” plugin.
- Install and activate the plugin.
- Once activated, the plugin will automatically disable all RSS feeds on your WordPress site.
After following either method, the RSS feeds on your WordPress site will be disabled. Visitors accessing the default RSS feed URLs will receive a message stating that no feed is available, and they will be redirected to the homepage.