In wp_create_post_autosave()
, intersect the $new_autosave
's keys with the keys from _wp_post_revision_fields()
to ensure that all expected fields are present.
Props kovshenin. Fixes #25416. git-svn-id: https://develop.svn.wordpress.org/trunk@27690 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
82ba1702df
commit
9cd40edebf
@ -1468,7 +1468,7 @@ function wp_create_post_autosave( $post_data ) {
|
||||
// If the new autosave has the same content as the post, delete the autosave.
|
||||
$post = get_post( $post_id );
|
||||
$autosave_is_different = false;
|
||||
foreach ( array_keys( _wp_post_revision_fields() ) as $field ) {
|
||||
foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields() ) ) as $field ) {
|
||||
if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
|
||||
$autosave_is_different = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user