Snippets Library

Disable RSS Feeds

Posted by Editorial Staff

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.

  1. Log in to your WordPress site.
  2. Go to “Appearance” and click on “Theme Editor”.
  3. Locate and click on “functions.php” on the right-hand side.
  4. Add the following code at the end of the file:
  5. // 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 homepage.');
    }
    add_action('init', 'wpr_disable_all_feeds');
  6. Click on the “Update File” button to save the changes.

Method 2: Using a Plugin

  1.  Log in to your WordPress admin dashboard.
  2. Go to “Plugins” and click on “Add New”.
  3. Search for the “Disable Feeds” plugin.
  4. Install and activate the plugin.
  5. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *