I'm Trying to scheduling wp_cron job in my website to send email everyday without opening my website but this is not happening. This work when user come to the website or reload a page.
Here is my code to scheduling cron job
// WP_CRON Scheduling function my_custom_cron_schedule( $schedules ) { $schedules['every_one_minute'] = array( 'interval' => 60, // Every 1 Minute 'display' => __( 'Every 1 Minute' ), ); return $schedules; } add_filter( 'cron_schedules', 'my_custom_cron_schedule' ); //Schedule an action if it's not already scheduled if ( ! wp_next_scheduled( 'my_cron_function_hook' ) ) { wp_schedule_event( current_time('timestamp'), 'every_one_minute', 'my_cron_function_hook' ); } ///Hook into that action that'll fire every One Minute add_action( 'my_cron_function_hook', 'my_cron_function' ); //create your function, that runs on cron function my_cron_function() { $crtime = date('F-j-Y h:i:s'); wp_mail('[email protected]','Cron Job Test', "$crtime"); }