Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

curious developer
curious developer
1,768 Points

Does wp-cron run all tasks scheduled at the same time together or one after other?

I am developing a plugin and want to add a cron task(let's say cron_task_test) but have a doubt. In case 15 tasks(they may be scheduled by multiple plugins or the user himself) are scheduled to run at a time along with my task(cron_task_test), will wp-cron pick them one by one i.e. pick another task after first has finished or if the first task has taken more than a minute? Or does all will be fired one after another

In short, how do cron_lock works? In case it executes one after another, will not the main cron thread running all tasks one by one itself exceed maximum execution time limit of the server(generally 30 seconds)?

What will happen if any other cron task before my task(cron_task_test) has thrown an error or exceeded time-limit? A

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

I really am not sure, as I don't have any experience with this, but here is a link to the documentation. I hope that helps a little bit: https://developer.wordpress.org/plugins/cron/