Skip to content

Instantly share code, notes, and snippets.

@tillkruss
Last active December 11, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tillkruss/4639713 to your computer and use it in GitHub Desktop.
Save tillkruss/4639713 to your computer and use it in GitHub Desktop.
Disable all WordPress feeds.
<?php
add_action( 'do_feed_rdf', function() { wp_redirect( home_url(), 301 ); exit; }, 1);
add_action( 'do_feed_rss', function() { wp_redirect( home_url(), 301 ); exit; }, 1);
add_action( 'do_feed_rss2', function() { wp_redirect( home_url(), 301 ); exit; }, 1);
add_action( 'do_feed_atom', function() { wp_redirect( home_url(), 301 ); exit; }, 1);
add_action( 'init', function() {
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment