cywhale
Member
Posted 3 years ago #
Hello.
For one of the next versions of CyStats (a WP statistics plugin) i intended to implement wp-super-cache compatibility. Right now CyStats uses the WordPress init-Hook for collecting and saving data, resulting in no data at all if wp-super-cache is used and enabled.
Is there any hook which could be used for collecting data ($_SERVER[], WordPress post/page IDs,...) and saving it ($wpdb-...) which is usable if wp-super-cache is enabled?
The only solution i found is using a javascript-snippet (embedded in the requested pages/posts)+external script to collect and save data but javascript is the one 'feature' i tried to avoid completely...
Greets
Michael
Use a fake stylesheet LINK tag as a trigger instead of javascript. Works just as well, doesn't have the same problems as javascript. As long as you return a blank file to the browser from that hit, the browser won't be affected in any major way.
Make sure that you return proper no-cache headers on the blank response, so that the hits are recorded correctly and the browser doesn't cache it.
cywhale
Member
Posted 3 years ago #
Hm. Thanky you. So there is absolutely no way to use an internal hook?
Just tested add_action('add_cacheaction','cystats_logger'); (the hook mentioned at the wp-super-cache additional notes) instead of using 'init'-hook but did not receive any reaction of cystats.
Tried to avoid external scripts - does a stylesheet link with parameters like ?pageid=1&bla=blub&blub=bla... validate? Referer-stats wouldn't be possible, too.
cywhale
Member
Posted 3 years ago #
No way, knowing the cache mechanisms now - only an external script would be able to track statistics data. Thank you very much.
There's no way to hook when using "super cache", because it's never actually running any PHP code. But if you turn that off and just use the normal wp-cache mechanism, you can hook there.
cywhale
Member
Posted 3 years ago #
Yes, thank you - thats what i found out when after deactivating wpsc wordpress still delivered the cached page via the wpsc .htaccess :)
bobkumar
Member
Posted 3 years ago #
Not sure if this is the best place to post this, but I am looking for a clean way of refreshing the cache in WordPress via a CRON job (daily)...I have a custom site developed where content is published to the site directly to the database daily and need to refresh the cache daily to get it working properly.
Anyone know how I can do this for WP 2.5+