Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to run an update script on pages that haven't been viewed and updated within X days. I'm using post meta to cache some related RSS feed data, and I want it updated once a week or two, but only if the page has actually been viewed within the last two or three weeks, bots included.

Is there an internal counter or whatnot that has this data, or am I going to have to build something that stores the UNIX timestamp as post meta upon page view?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Post views log/count is not available natively. It is resource-intensive (database writes are much more expensive than reads) and won't work (if done in pure PHP) with most caching plugins.

There is number of plugins/services that offers Analytics via JS- or image-based tracking. Your best bet is to let such service handle analytics and pull data from there.

share|improve this answer

Most webservers have a so called logfile. When your site makes use of effective canonical permalinks, you can gain that information from the request URIs stored in the access-log-files.

This can be run as a janitor job in the background once a day/week while querying the URIs against your site's permalink structure and a genereate superset of all URIs as a hash-table to post IDs.

share|improve this answer
    
This would work, but it would be next to impossible to generalize a plugin to do something like this. Cool idea though. –  Dan Gayle Oct 15 '10 at 22:52
    
Yeah this is specific to the installation. I think you need something weighted anyway because crawlers will visit any page once. –  hakre Oct 15 '10 at 22:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.