WordPress scheduled task is called but not executed

I was having the same issue recently, until I followed an example from the WordPress Codex which suggests using action hooks to run the function.

I think if you add the following…

add_action( 'recalculate_all_scores_hook', 'recalculate_all_scores' );

…and amend the wp_schedule_event function to use the action hook name rather than the function directly…

wp_schedule_event( time(), 'fiveminutes', 'recalculate_all_scores_hook' );

…you might be in business.

Good luck!

Leave a Comment