I am making an attempt to run run_providers
every day with wp_schedule_event
, but it surely is not working. if I add add_action( 'wp', 'run_cdc_providers' )
, run_providers
works — so it would not work on schedule.
I examined it out with echo '<pre>'; print_r( _get_cron_array() ); echo '</pre>'
and run_providers
is registered / displaying.
This is my code:
register_activation_hook(__FILE__, 'schedule_providers');
add_action( 'providers_scheduled_sync', 'run_providers' );
perform schedule_providers() {
if ( !wp_next_scheduled( 'providers_scheduled_sync' ) )
wp_schedule_event( strtotime('14:17:00'), 'every day', 'providers_scheduled_sync' );
}
perform run_providers() {
require_once(ABSPATH . '/suppliers.php');
}
register_deactivation_hook(__FILE__, 'unschedule_providers');
perform unschedule_providers() {
wp_clear_scheduled_hook('providers_scheduled_sync');
}
Can anybody level out what I am doing flawed please? Thanks!