@@ -2005,7 +2005,7 @@ function wp_create_post_autosave( $post_data ) {
20052005}
20062006
20072007/**
2008- * Autosave the revisioned meta fields.
2008+ * Autosaves the revisioned meta fields.
20092009 *
20102010 * Iterates through the revisioned meta fields and checks each to see if they are set,
20112011 * and have a changed value. If so, the meta value is saved and attached to the autosave.
@@ -2027,15 +2027,14 @@ function wp_autosave_post_revisioned_meta_fields( $new_autosave ) {
20272027 $ post_type = get_post_type ( $ new_autosave ['post_parent ' ] );
20282028
20292029 /*
2030- * Go thru the revisioned meta keys and save them as part of the autosave, if
2031- * the meta key is part of the posted data, the meta value is not blank and
2032- * the the meta value has changes from the last autosaved value.
2030+ * Go through the revisioned meta keys and save them as part of the autosave,
2031+ * if the meta key is part of the posted data, the meta value is not blank,
2032+ * and the meta value has changes from the last autosaved value.
20332033 */
20342034 foreach ( wp_post_revision_meta_keys ( $ post_type ) as $ meta_key ) {
20352035
2036- if (
2037- isset ( $ posted_data [ $ meta_key ] ) &&
2038- get_post_meta ( $ new_autosave ['ID ' ], $ meta_key , true ) !== wp_unslash ( $ posted_data [ $ meta_key ] )
2036+ if ( isset ( $ posted_data [ $ meta_key ] )
2037+ && get_post_meta ( $ new_autosave ['ID ' ], $ meta_key , true ) !== wp_unslash ( $ posted_data [ $ meta_key ] )
20392038 ) {
20402039 /*
20412040 * Use the underlying delete_metadata() and add_metadata() functions
@@ -2044,13 +2043,9 @@ function wp_autosave_post_revisioned_meta_fields( $new_autosave ) {
20442043 */
20452044 delete_metadata ( 'post ' , $ new_autosave ['ID ' ], $ meta_key );
20462045
2047- /*
2048- * One last check to ensure meta value not empty().
2049- */
2046+ // One last check to ensure meta value is not empty.
20502047 if ( ! empty ( $ posted_data [ $ meta_key ] ) ) {
2051- /*
2052- * Add the revisions meta data to the autosave.
2053- */
2048+ // Add the revisions meta data to the autosave.
20542049 add_metadata ( 'post ' , $ new_autosave ['ID ' ], $ meta_key , $ posted_data [ $ meta_key ] );
20552050 }
20562051 }
0 commit comments