Skip to content

Instantly share code, notes, and snippets.

@richardmtl
Created July 15, 2014 16:56
Show Gist options
  • Save richardmtl/04a8bdc7f7230ea4ea52 to your computer and use it in GitHub Desktop.
Save richardmtl/04a8bdc7f7230ea4ea52 to your computer and use it in GitHub Desktop.
Remove Jetpack Stats from homepage only
add_action( 'init', 'jp_remove_stats');
add_action( 'template_redirect', 'jp_maybe_add_tracking_code', 1);
function jp_remove_stats(){
remove_action( 'template_redirect', 'stats_template_redirect', 1 );
}
function jp_maybe_add_tracking_code(){
if( !is_home() ){
stats_template_redirect();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment