Running WP Cron on specific local time
The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday.
function add_daily_task(){
if((date('l', time()) != 'Saturday') || (date('l', time()) != 'Sunday')){
// insert post
}
}
if(!wp_next_scheduled( 'add_daily_task_schedule')){
wp_schedule_event(time(), 'daily', 'add_daily_task_schedule');
// how should change time() to meet my local schedule?
}
add_action('add_daily_task_schedule', 'add_daily_task');
Topic localization wp-insert-post cron date-time Wordpress
Category Web