I have the following function created in my functions.php . I am changing the theme to schedule, and I can see that it is scheduled by the next_schedule
function.
add_action( 'after_switch_theme', 'prefix_setup_schedule' );
function prefix_setup_schedule() {
if ( ! wp_next_scheduled( 'sendemail' ) ) {
$timeschedule = strtotime(date("Y-m-d 18:00:00"));
wp_schedule_event( $timeschedule, 'daily', 'sendemail');
}
}
function sendemail()
{
update_option('envioemail','feito');
}
However, this code is not running, does anyone have any ideas?