bransonsparks
Member
Posted 1 year ago #
It would be great to be able to specify on the configuration page post IDs that wp-stats should not track. This is a snippet that I added into the stats.php file to ignore a specific page, which I use as a homepage.
//here is a fun thing to keep the homepage from being tracked
if ( $a['post'] == "1565" ){
echo ('<p style="text-align:center">not tracked</p>');
return;
}
//this is the end of the fun thing to keep the homepage from being tracked
I drop that in around line 110 in stats.php, in the stats_footer function. Works great, but I have to add it in at every update!
http://wordpress.org/extend/plugins/stats/
jjsulzbach
Member
Posted 1 year ago #
I also needed to exclude the homepage from the get_stats_csv returns, but I needed to avoid editing the original function.
So I wrote a wrapper function and posted it in the "Hacks" forum at:
http://wordpress.org/support/topic/stats-plugin-excluding-homepage-from-stats_get_csv-results?replies=1#post-1721505
Maybe it might help someone.
@bransonsparks Can this be used to ignore multiple pages or posts?
bransonsparks
Member
Posted 8 months ago #
I should think so.
Try this:
if ( $a['post'] == "page1" || "page2" || "page3" ){
etc.
bransonsparks
Member
Posted 8 months ago #
...whoops, with the rest of the code from above. I don't know if the plugin code has changed since I posted this nearly a year ago. I know that WPStats runs through Jetpack now.
I'm not using this hack anymore; I ditched my personal homepage.
I am still able to show popular posts, based on views, on my website using the old WP stats code. Want to prevent a couple of pages from showing up in that list. Let me see if it works.
Thanks.