Is there an equivalent to Drupal’s Batch API in WordPress?

No, there isn’t such an API, but if you’d like one you can:

  • Build it yourself
  • Open a ticket on WP Core Trac

But putting that aside, if you need to delete, create, or update 1 million posts or something of a similar scale, doing it via the frontend is not a good thing, even with an AJAX powered progress bar.

3rd party plugins have indeed implemented things similar to this, but not in a super generic way. There is no ‘generic batch ajax request’ plugin. An example would be the thumbnail regenerator plugins.

In the future, it may be better to use the upcoming REST API to do your requests. You can then make your javascript requests and change posts in batches or 1 by 1, and implement your progress bar.

As a developer who’s worked with Managed WordPress hosting

I doubt WP Engine would be happy with this, nor would your client ( 1 million requests to update posts, 1 million hits, that’s a lot of hits on a service that uses hits to determine pricing ). So what you propose is potentially going to be quite expensive in $$$ terms, $1 per 1000 hits on overage pricing, I doubt your client will be pleased

So unless you’re on the WP Engine enterprise package with millions of hits, you could be:

  • Business! 400k hits, 600,000/1000 = $600 for the first million deleted + $1k for every additional million, + traffic/1000
  • Professional! 100k hits, 900,000/1000 = $900 for the first million deleted + $1k for every additional million, + traffic/1000
  • Personal! 25k hits, 975,000/1000 = $900 for the first million deleted + $1k for every additional million, + traffic/1000

It may cost more or less on other managed WordPress services, but it’s still a risky proposition, especially if it doesn’t work right the first time and you need to repeat the process

But even if you ignore pricing, those are a lot of requests, and requests take time. Even if they take a tiny amount of time, that adds up. Your progress bar is going to be waiting for a while…

What I would do

Instead it would be better to pull down the site locally, run your commands using WP CLI, then upload the new database. You have a git repo with your code, you have SFTP access, you have PHPMyAdmin for the database, it can be done. Even the majority of $1pm shared hosts provide these facilities.

You don’t need SSH access when you can pull it down into an environment totally under your control, and the download and upload will be a lot faster than hundreds of thousands of AJAX requests.

As a bonus you get a free up to date copy of the live content!