Ticket #27792: 27792.2.diff
File 27792.2.diff, 2.3 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/post.php
421 421 $children = array(); 422 422 423 423 for ( $i = 0; $i < 50 && $parent > 0; $i++ ) { 424 424 $children[] = $parent; 425 425 426 426 foreach ( $pages as $page ) { 427 427 if ( $page->ID == $parent ) { 428 428 $parent = $page->post_parent; 429 429 break; 430 430 } 431 431 } 432 432 } 433 433 } 434 434 435 435 $updated = $skipped = $locked = array(); 436 $user_post_data = $post_data; 436 437 foreach ( $post_IDs as $post_ID ) { 438 // Reset the post data on each iteration 439 $post_data = $user_post_data; 437 440 $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); 438 441 439 442 if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( 'edit_post', $post_ID ) ) { 440 443 $skipped[] = $post_ID; 441 444 continue; 442 445 } 443 446 444 447 if ( wp_check_post_lock( $post_ID ) ) { 445 448 $locked[] = $post_ID; 446 449 continue; 447 450 } 448 451 449 452 $post = get_post( $post_ID ); 450 453 $tax_names = get_object_taxonomies( $post ); 451 454 foreach ( $tax_names as $tax_name ) { … … 470 473 } 471 474 472 475 $post_data['post_type'] = $post->post_type; 473 476 $post_data['post_mime_type'] = $post->post_mime_type; 474 477 $post_data['guid'] = $post->guid; 475 478 476 479 foreach ( array( 'comment_status', 'ping_status', 'post_author' ) as $field ) { 477 480 if ( ! isset( $post_data[ $field ] ) ) { 478 481 $post_data[ $field ] = $post->$field; 479 482 } 480 483 } 481 484 482 485 $post_data['ID'] = $post_ID; 483 486 $post_data['post_ID'] = $post_ID; 484 487 485 $ translated_post_data = _wp_translate_postdata( true, $post_data );486 if ( is_wp_error( $ translated_post_data ) ) {488 $post_data = _wp_translate_postdata( true, $post_data ); 489 if ( is_wp_error( $post_data ) ) { 487 490 $skipped[] = $post_ID; 488 491 continue; 489 492 } 490 493 491 $updated[] = wp_update_post( $ translated_post_data );494 $updated[] = wp_update_post( $post_data ); 492 495 493 496 if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { 494 497 if ( 'sticky' == $post_data['sticky'] ) 495 498 stick_post( $post_ID ); 496 499 else 497 500 unstick_post( $post_ID ); 498 501 } 499 502 500 503 if ( isset( $post_data['post_format'] ) ) 501 504 set_post_format( $post_ID, $post_data['post_format'] ); 502 505 } 503 506 504 507 return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked ); 505 508 } 506 509