WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.