if ( !
empty( $post_data['post_date_gmt'
] ) ) { // We know this is supposed to be GMT, so we're going to slap that Z on there by force.
$dateCreated =
rtrim( $post_data['post_date_gmt'
]->
getIso(), 'Z'
) . 'Z';
} elseif ( !
empty( $post_data['post_date'
] ) ) { $dateCreated =
$post_data['post_date'
]->
getIso();
} // Default to not flagging the post date to be edited unless it's intentional.
$post_data['edit_date'
] = false;
if ( !
empty( $dateCreated ) ) { $post_data['post_date'
] =
iso8601_to_datetime( $dateCreated );
$post_data['post_date_gmt'
] =
iso8601_to_datetime( $dateCreated, 'gmt'
);
// Flag the post date to be edited.
$post_data['edit_date'
] = true;
} if ( !
isset( $post_data['ID'
] ) ) { $post_data['ID'
] =
get_default_post_to_edit( $post_data['post_type'
], true
)->ID;
} $post_id =
$post_data['ID'
];