I can’t schedule (I don’t know how I should do it) separately CRON jobs because I had a few situations when some function was run before I have necessary data
The key to doing this is scheduling the first job to run daily at the required time, and have that event create all of the other ones after it is done.
function wcs_cron_system_update($step = 0) {
switch ($step) {
case 0:
// do what has to be done first
break;
case 1:
// second step
break;
case 2:
// etc
break;
}
}
If you start like this, you can pass the $step
as an argument to it. So on the daily cron it executes step 0.
After the first step is done, what you can do is call wp_schedule_single_event()
like so
\wp_schedule_single_event(
// start in 5min
\current_time('timestamp') + (5 * 60),
'same_hook_as_daily_cron',
[1]
);
This will create an event for your second step. When that is done, just create a single event for your third step. Make sure your add_action
code allows for arguments.