WordPress cron hooks – same callback for completely different action?

No, not quite. When you say this: wp_schedule_single_event( $sent_on, ‘my_custom_cron’, [ $notif_id, $notif_name, $membership_id, $lesson_id ] ); You are essentially saying is when the current time passes $sent_on, do: do_action( ‘my_custom_cron’, [ $notif_id, $notif_name, $membership_id, $lesson_id ] ); Cron jobs are just a TODO note to fire an action with some arguments in the future. … Read more

Issue with wp_schedule_event()

You need to schedule the event differently. In your approach, you hook to wp to schedule the event, meaning that it is called everytime WordPress is called, setting your option back. I am not quite sure if the schedule is postponed or if you create multiple schedules this way, but it is not correct. You … Read more

Use cron to create a non blocking task

For instance, since the configured cron tasks will only be run on page load, the task might not be run at the desired interval if there are no visitors. To prevent this, you need to use your operating system’s task scheduler. For this, you need to define define(‘DISABLE_WP_CRON’, true); in your wp-config.php file. After that, … Read more

Wp Cron and WordPress Updates

If I disable wp-cron from config, will automatic updates still work? No, neither will scheduled posts, transient cleanup, trash clearing after 30 days, or automatic plugin updates, and some other things. Anything that relies on timed or scheduled activities will break. It seems you already know the solution, though the real solution is to identify … Read more