From 4eadc109f8e07bff654616e618a11bdf2f1ff346 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 24 Mar 2014 20:32:14 +0000 Subject: [PATCH] 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 --- wp-admin/includes/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index b793c42e91..c8ea674c9f 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -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;