Skip to content

Instantly share code, notes, and snippets.

@bhubbard
Created December 22, 2015 03:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhubbard/d075c601d05cafd69984 to your computer and use it in GitHub Desktop.
Save bhubbard/d075c601d05cafd69984 to your computer and use it in GitHub Desktop.
Disable Jetpack stats for all IDX Wrapper pages. Used this site as a reference for the code: https://www.skyverge.com/blog/exclude-your-traffic-from-jetpack-site-stats/
<?php
add_action( 'template_redirect', 'idxbroker_disable_jetpack_stats' );
function idxbroker_disable_jetpack_stats() {
// Check that we are on a single IDX Wrapper
if ( is_singular('idx-wrapper') ) {
remove_action( 'wp_footer', 'stats_footer', 101 );
remove_action( 'wp_head', 'stats_add_shutdown_action' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment