How to Disable RSS Feeds in WordPress106

How-to-Disable-RSS-Feeds-in-WordPress

RSS feeds allow viewers to subscribe to your site. But, if you want to disable RSS feeds, you may see the 2 different methods below to do it.

Method 1: Disable RSS feeds using a plugin

To disable RSS feeds using a plugin follow the steps below:

  • Install and activate ‘Disable Feeds’ plugin.
  • Go to Settings > Reading to configure, now you should be able to see the page as shown in the picture below:

search-engine

  • Now change the behavior to ‘Issue a Page Not Found (404) error for feed requests’. And also, tick on ‘Do not disable the global post feed and global comment feed)
  • Click on Save Changes.

Method 2: Manually disable RSS feeds in WordPress

In this method, you need to copy and paste the codes given below in your themes functions.php file or a site-specific plugin.

function wpb_disable_feed() {

wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );

}

add_action('do_feed', 'wpb_disable_feed', 1);

add_action('do_feed_rdf', 'wpb_disable_feed', 1);

add_action('do_feed_rss', 'wpb_disable_feed', 1);

add_action('do_feed_rss2', 'wpb_disable_feed', 1);

add_action('do_feed_atom', 'wpb_disable_feed', 1);

add_action('do_feed_rss2_comments', 'wpb_disable_feed', 1);

add_action('do_feed_atom_comments', 'wpb_disable_feed', 1);

(note: this code shows an error page whenever someone requests RSS feeds.