One annoying problem with ZdStats (statistics plugin for wordpress) is that it does not have a feature where by you can filter out visits of admin. Yes, there is IP filter, but it would not work for admins with dynamic IPs like me. Also there is a bug where AJAX requests from the admin panel are also counted in visits (2 x page views while writing a post). Not what you want.
What I did? Patched the zd_stats.php file Solution works like this:1. a cookie is set when the admin visits the ZdStats admin interface.2. When recording, visits with the particular cookie set are not recorded.
Note: this patch is for only ZdStats V1.1.2Modify the following lines in zd_stats.php.1. Add the following line at line 40:
$zdstats_admin_id = 'I_am_the_admin';
That variable will be used for identifying admin. Change it to anything different you like and keep changing it once in a month or so. 2. find zd_stats_page() function and add the following lines after theglobal $savebots_option_name;
global $zdstats_admin_id;setcookie( 'zdstats_admin' , $zdstats_admin_id , time() + 86400 * 10, '/', '.nirandas.com');
Change the '.nirandas.com' with your domainname. 3. Find the zd_stats_record() function and paste the following lines just after the line ¼br /> $IP=$_SERVER['REMOTE_ADDR'];
if( isset( $_COOKIE[ 'zdstats_admin'])){//verify that the cookie is realif( $_COOKIE[ 'zdstats_admin'] == $zdstats_admin_id )return;}
Done! Now the visits from the admin should not be counted. And, do a backup of zd_stats.php file before making any changes.