Changeset 23862
- Timestamp:
- 03/29/2013 12:08:42 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r23861 r23862 1279 1279 $new_autosave['ID'] = $old_autosave->ID; 1280 1280 $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 1281 1293 return wp_update_post( $new_autosave ); 1282 1294 } -
trunk/wp-includes/revision.php
r23859 r23862 505 505 $post->post_excerpt = $preview->post_excerpt; 506 506 507 add_filter( 'get_post_metadata', '_wp_preview_meta_filter', 10, 4 ); 508 507 509 return $post; 510 } 511 512 /** 513 * Filters post meta retrieval to get values from the actual autosave post, 514 * and not its parent. Filters revisioned meta keys only. 515 * 516 * @since 3.6 517 * @access private 518 */ 519 function _wp_preview_meta_filter( $value, $object_id, $meta_key, $single ) { 520 $post = get_post(); 521 522 if ( $post->ID != $object_id || ! in_array( $meta_key, _wp_post_revision_meta_keys() ) || 'revision' == $post->post_type ) 523 return $value; 524 525 $preview = wp_get_post_autosave( $post->ID ); 526 return get_post_meta( $preview->ID, $meta_key, $single ); 508 527 } 509 528
Note: See TracChangeset
for help on using the changeset viewer.