0

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?

0

2 Answers 2

1

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.

0

Take a look at schedule functions in Codex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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