Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieliser/889701698a67daf9271dee529dec54f1 to your computer and use it in GitHub Desktop.
Save danieliser/889701698a67daf9271dee529dec54f1 to your computer and use it in GitHub Desktop.
Disable tracking of Super Admins & Admins with WPMUDev Google Analytics+
<?php
// Disable Analytics for Admins.
add_action( 'init', function () {
global $google_analytics_async;
if ( is_super_admin() || current_user_can( 'administrator' ) ) {
remove_action( 'wp_head', array( $google_analytics_async, 'tracking_code_output' ) );
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment