Reputation: 8757
I have written a WordPress plugin that analyzes a post and extracts some data from the body on save (using the save_post
action).
My installation has almost 8,000 posts, and I need to perform this retroactively on every single post. So, I need a batch job of some kind that will iterate every post and perform this operation without timing out.
There are a number of ways to architect this, but is there a commonly accepted way of doing this?
Upvotes: 3
Views: 1713
Reputation: 158
Ashley Rich from Delicious Brains created a Background Processing class that was designed to solve this exact problem. You can find the source code here. You can also find an example of it being used inside the WooCommerce plugin
Upvotes: 5