WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/29/2013 12:08:42 PM (8 years ago)
Author:
markjaquith
Message:

Use the revisioned post format metadata when previewing.

fixes #23539. props kovshenin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r23861 r23862  
    12791279        $new_autosave['ID'] = $old_autosave->ID;
    12801280        $new_autosave['post_author'] = $post_author;
     1281
     1282        // Auto-save revisioned meta fields too.
     1283        foreach ( _wp_post_revision_meta_keys() as $meta_key ) {
     1284            if ( ! isset( $_POST[ $meta_key ] ) )
     1285                continue;
     1286
     1287            // Use the underlying delete_metadata and add_metadata vs delete_post_meta
     1288            // and add_post_meta to make sure we're working with the actual revision meta.
     1289            delete_metadata( 'post', $new_autosave['ID'], $meta_key );
     1290            add_metadata( 'post', $new_autosave['ID'], $meta_key, $_POST[ $meta_key ] );
     1291        }
     1292
    12811293        return wp_update_post( $new_autosave );
    12821294    }
Note: See TracChangeset for help on using the changeset viewer.