How do I efficiently perform a batch processing action on almost 8,000 WordPress posts?
wordpress
Solution
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
Problem
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?