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'm trying to make a popularity calculation for all posts, based on page view and date of creation. Initially, there's a default popularity value saved in postmeta. Every hour I want to recalculate the popularity among all posts by cron job.

How can I update all post's popularity in postmeta table?

share|improve this question
add comment

2 Answers

You probably would have to use a script which would have to be referenced in your crontab. The problem is to calculate the final value of the popularity for each post, but if you apply the funcion the right way in the PHP script, the UPDATE operation on your MySQL database should work nicely.

Here you've got a discussion on how to apply that kind of operation (though the final values are easier to get) and there was a good discussion on this subject on StackOverflow sometime ago.

share|improve this answer
add comment

Take a look at schedule functions in Codex.

share|improve this answer
add comment

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.