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’); 4 Answers 4 … Read more

Custom Post Type Archives by Date with Custom Permalink

I’m a bit stuck with getting the custom permalink for custom post type (CPT) archive to work. I’ve registered my ‘press_release’ CPT as following: add_action(‘init’, ‘press_release_post_type_init’); function press_release_post_type_init() { $labels = array( ‘name’ => _x(‘Press Releases’, ‘post type general name’), ‘singular_name’ => _x(‘Press Release’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘Press Release’), ‘add_new_item’ … Read more