WP-ShortStat not counting? Fixed!

After yesterday’s upgrade I decided to enable the WP-ShortStat plugin, which seems to come bundled at least with version 2.0.6 (maybe even earlier, but I did not notice). I was quite surprised why, after I enabled it, its tables remained empty and the stats (logically!), were zero too.

Since I know that my blog does not have _that little_ visitors (well, at least I visit it, don’t I?), I decided to look for the reason. After some hacking through the code, I saw that because of some reason, this plugin looks for the function ‘is\_admin\_page’ and if such function is not defined, it defines it. Obviously, something was wrong with that function, because my debugging showed that if I just remove the call to it, everything goes smooth.

I did not want to search more. I have no idea what is going wrong, and honestly – I do not care. I even tend to think that the function is totally useless, since the plugin detects quite well the ‘admin pages’ by looking for ‘wp-admin’ in the page URL. What is important for me after the whole research is that my counters started to go up :).

If you observe the same problem and if you share my thoughts, you may try to fix your wp-shortstat.php file. It’s simple:

* Open the file in an editor
* look for “is\_admin\_page()” in this file. You will find a fragment, which will look like:

|| strstr($_SERVER['PHP_SELF'], 'wp-admin/')
|| is\_404()
|| is\_admin\_page()

* Once you find this fragment, delete the line “|| is_admin_page()”, or if you want to be good boy/gal, just add two back slashes _//_ in front of it like that:

|| strstr($_SERVER['PHP\_SELF'], 'wp-admin/')
|| is\_404()
__//__|| is\_admin\_page()

* Save the file. You’re done. The thing should immediately start counting your visits.

4 thoughts on “WP-ShortStat not counting? Fixed!

  1. No, it is not bundled with 2.0.6… neither with the previous versions (just look into the installation package). And if you are not the guy who installed it… you have a good reason to worry about 😉

  2. @yovko: Weird! I obviously forgot when I installed it… should be a long time ago, indeed. Can you remember February 2004 🙂 ? I mean, if you do not read your blog, can you remember it?

Leave a Reply

Theme: Overlay by Kaira Extra Text