Move the revisions upgrade handler to POST, to avoid esoteric metadata stomping.
props SergeyBiryukov. see #25023. for trunk. Built from https://develop.svn.wordpress.org/trunk@25719 git-svn-id: http://core.svn.wordpress.org/trunk@25632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
71fb968dd3
commit
a00df382a3
|
@ -114,10 +114,6 @@ $publish_callback_args = null;
|
|||
if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
|
||||
$revisions = wp_get_post_revisions( $post_ID );
|
||||
|
||||
// Check if the revisions have been upgraded
|
||||
if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
|
||||
_wp_upgrade_revisions_of_post( $post, $revisions );
|
||||
|
||||
// We should aim to show the revisions metabox only when there are revisions.
|
||||
if ( count( $revisions ) > 1 ) {
|
||||
reset( $revisions ); // Reset pointer for key()
|
||||
|
|
|
@ -178,6 +178,15 @@ function edit_post( $post_data = null ) {
|
|||
wp_die( __('You are not allowed to edit this post.' ));
|
||||
}
|
||||
|
||||
if ( post_type_supports( $ptype->name, 'revisions' ) ) {
|
||||
$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 ) );
|
||||
}
|
||||
|
||||
$post_data = _wp_translate_postdata( true, $post_data );
|
||||
if ( is_wp_error($post_data) )
|
||||
wp_die( $post_data->get_error_message() );
|
||||
|
|
Loading…
Reference in New Issue