// If the post is an autodraft, save the post as a draft and then attempt to save the meta.
if ( 'auto-draft' ===
$post->post_status
) { $post_data = array
();
$post_data['action'
] = 'draft'; // Warning fix.
$post_data['post_ID'
] =
$pid;
$post_data['post_type'
] =
$post->post_type;
$post_data['post_status'
] = 'draft';
$now =
time();
/* translators: 1: Post creation date, 2: Post creation time. */
$post_data['post_title'
] =
sprintf( __( 'Draft created on %1$s at %2$s'
),
gmdate( __( 'F j, Y'
),
$now ),
gmdate( __( 'g:i a'
),
$now ) );
$pid =
edit_post( $post_data );
if ( $pid ) { if ( is_wp_error( $pid ) ) { $x =
new WP_Ajax_Response( array
( 'what' => 'meta',
'data' =>
$pid,
) );
$x->
send();
}