Using a custom CRON job set up in my Wordpress site I am connecting to an external API to refresh some data. The API only allows for a certain amount of records to be read at a time so I have to "page" through, once one set of data is loaded then make another request to the API and load more, etc.

The problem is that this can quite often run out of memory or just go on too long and error out for large batches of data.

I am wondering if there is any kind of solution for "jobs" or "workers" in Wordpress, where after the first page of results is processed then submit another job for the next page and it's run as a second request instead of one long string.

  • You can disable WP-Cron by adding define('DISABLE_WP_CRON', true); and use system cron and wp_schedule_event instead .
    – Anoop D
    Oct 22, 2021 at 12:03
  • Thanks @AnoopD, this can still run into limitations on request time. Looking at how it can be divided up into separate request but started with a single, keep in mind the results are paginated so it has to work through all "pages".
    – Louis W
    Oct 22, 2021 at 12:05
  • Within what interval you intend to run the task ?
    – Anoop D
    Oct 23, 2021 at 5:16


Your Answer

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

Browse other questions tagged or ask your own question.