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. Built from https://develop.svn.wordpress.org/trunk@27690 git-svn-id: http://core.svn.wordpress.org/trunk@27529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0115ba2f30
commit
4eadc109f8
|
@ -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