$revisions =
wp_get_post_revisions( $post_id,
array
( 'order' => 'ASC',
'posts_per_page' => 1,
) );
$revision =
current( $revisions );
// Check if the revisions have been upgraded.
if ( $revisions &&
_wp_get_post_revision_version( $revision ) < 1
) { _wp_upgrade_revisions_of_post( $post,
wp_get_post_revisions( $post_id ) );
} } if ( isset( $post_data['visibility'
] ) ) { switch ( $post_data['visibility'
] ) { case 'public':
$post_data['post_password'
] = '';
break;
case 'password':
unset( $post_data['sticky'
] );
break;