The problem here is a mistake regarding how to schedule a cron event, lets begin with:
wp_schedule_event(time(), 'hourly', 'my_schedule_hook', $args);
wp_schedule_event(time(), 'hourly', 'update_user_hours');
Here you are telling WordPress to fire the update_user_hours
action/event on an hourly basis.
You then hook into this to fire a callback:
add_action('update_user_hours', 'do_this_hourly');
But then, instead of declaring do_this_hourly
, for some reason the code declares a mystery function named update_user_hours
:
function update_user_hours(){
error_log('the function actually gets called')
}
So the do_this_hourly
function is undefined, a completely random new function is added that’s totally disconnected, and to top it off, there’s a missing semi colon. I would expect both syntax errors and missing callback warnings in your PHP error log
Extra Notes
WP_DEBUG_LOG
doesn’t enable the debug log, it just moves the PHP error log, you’d be better off using the real error log instead- Use WP CLI instead to trigger list and debug cron events, rather than a 3rd party plugin. Who knows what that plugin is doing or how it’s meddling
- Don’t hide warnings, fix them. If you’d checked it would have lead you straight to the cause and the fix without having to come here
- Try the Query Monitor plugin out, it’ll flag warnings, errors and other things