Event Calendar using insert_post_data after save_post and insert_post after post_transition draft_to_schedule

Hi @user2271:

I recently had to resolve a situation for an Event custom post type where I could not get WordPress to let me save a future date. I wasn’t trying to be as complex as yours but the follow code resolved my issue, maybe you can use it to resolve yours:

add_action('admin_init', 'yoursite_admin_init');
static function yoursite_admin_init() {
  global $pagenow;
  if ($pagenow=='post.php' && isset($_POST['post_date'])) { 
    $_POST['event_date'] = date('Y-m-d H:i:s',strtotime($_POST['post_date']));
  }
}
add_filter('wp_insert_post_data', 'yoursite_wp_insert_post_data',10,2);
static function yoursite_wp_insert_post_data($data,$postarr) {
  global $pagenow;
  if ($data['post_type']=='event') {
    // Saving an event, 'event_date' grabbed in admin_init
    if ($pagenow=='post.php' && isset($postarr['event_date'])) {
      $data['post_date'] = $data['post_date_gmt'] = $postarr['event_date'];
    }
  }
  return $data;
}

Basically WordPress is applying blog post logic to all posts and events should follow different logic. The code I’ve posted grabs the incoming date in the 'admin_init' hook and then reuses it in the 'wp_insert_post_data' hook after WordPress has “fixed up” the dates per blog post logic.

Understanding this issue I think will help you determine how to fix as per your more complex workflow?

Hope this heps.