I have a task scheduled to run daily using wp-cron. The task takes over a minute to run (between downloading and parsing a very large file with cURL). According to the WP documentation,

"The action will trigger when someone visits your WordPress site, if the scheduled time has passed."

Could this "someone" have to wait the full minute for my script to run while trying to access my site, or are wp-cron tasks asynchronous?

1 Answer 1


No, the WP-Cron tasks run asynchronously from the viewing user. They should not see any delay.

Although if your task takes more than a minute, it may never finish since most hosts are setup to kill PHP processes after 30 seconds.

  • I'm using set_time_limit to bypass the 30 second default (thanks). Do two independent wp-cron tasks run asynchronously from eachother? In other words, if there's an error (such as a timeout) on one, will the other fail to launch?
    – adamdport
    Commented Sep 11, 2012 at 16:50
  • 1
    The wp-cron process gets launched and runs all pending tasks until it's done, basically. Only one wp-cron process should run at a time. So it's asynchronous from the viewer of the site, but synchronous with the various tasks. Also, set_time_limit may not work on some (most) web hosts.
    – Otto
    Commented Sep 11, 2012 at 17:22
  • So if a single cron task has an error (such as the timeout we keep talking about), any remaining scheduled tasks will fail to run?
    – adamdport
    Commented Sep 11, 2012 at 17:31
  • 1
    Until the task succeeds, yeah, probably. Don't write cron tasks that can fail or cause timeouts.
    – Otto
    Commented Sep 11, 2012 at 17:36

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.