Skip to content

Instantly share code, notes, and snippets.

@cristovaov
Last active December 23, 2015 01:59
Show Gist options
  • Save cristovaov/10c57740cf372f808fb8 to your computer and use it in GitHub Desktop.
Save cristovaov/10c57740cf372f808fb8 to your computer and use it in GitHub Desktop.
Simple Feed disabler & redirect for WordPress -- snippet to add to your function file ---- see logbook for info/instructions http://wp.me/pKmdR-p8
/* disable and redirect feed links snippet
by Cristovao Verstraeten - apleasantview.com 2013*/
function simple_nofeed() {
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
if ( is_feed() )
{
status_header( '404' );
locate_template( array ( '404.php', 'index.php' ), TRUE, TRUE );
exit;
}
}
add_action( 'template_redirect', 'simple_nofeed' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment