Skip links

Disable All Feeds in WordPress

WordPress has feed features to can user follow your blog by feed readers like Feedly and sometimes you don’t need this feature maybe don’t some sites fo copy your content by feeds do if you search about a way to disable All Feeds in WordPress, you must now there were probably a plugin for this, this WordPress code snippet can do this task

This code snippet will let you filter by WordPress Hook built-in hooks.

Steps to disable all feeds in WordPress:

  1. Open WordPress admin panel then go to Appearance > Theme Editor
  2. Open theme functions.php file, if you work localhost open the same file using any code editor IDE
  3. Add the following code at the bottom of the file.
  4. Save the changes.

[php]
function zytheme_disableFeed() {
wp_die(__(‘<h1>This feed is closed now, please visit our <a href="’.get_bloginfo(‘url’).’">Home Page</a>!</h1>’));
}
add_action(‘do_feed’, ‘zytheme_disableFeed’, 1);
add_action(‘do_feed_rdf’, ‘zytheme_disableFeed’, 1);
add_action(‘do_feed_rss’, ‘zytheme_disableFeed’, 1);
add_action(‘do_feed_rss2’, ‘zytheme_disableFeed’, 1);
add_action(‘do_feed_atom’, ‘zytheme_disableFeed’, 1);

[/php]

Did you find the WordPress snippets in this article helpful? Share it with your friends and if you have any questions and want to ask us about it, please don’t hesitate to add comments.

Leave a comment

Explore
Drag