Ticket #56279: 56279.3.diff
| File 56279.3.diff, 2.2 KB (added by , 4 years ago) |
|---|
-
src/wp-admin/includes/meta-boxes.php
1459 1459 $publish_callback_args = array( '__back_compat_meta_box' => true ); 1460 1460 1461 1461 if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) { 1462 $revisions = wp_get_ post_revisions( $post->ID, array( 'fields' => 'ids' ));1462 $revisions = wp_get_latest_revision_id_and_total_count( $post->ID ); 1463 1463 1464 1464 // We should aim to show the revisions meta box only when there are revisions. 1465 if ( count( $revisions )> 1 ) {1465 if ( ! is_wp_error( $revisions ) && $revisions['count'] > 1 ) { 1466 1466 $publish_callback_args = array( 1467 'revisions_count' => count( $revisions ),1468 'revision_id' => reset( $revisions ),1467 'revisions_count' => $revisions['count'], 1468 'revision_id' => $revisions['latest_id'], 1469 1469 '__back_compat_meta_box' => true, 1470 1470 ); 1471 1471 -
src/wp-includes/revision.php
603 603 return null; 604 604 } 605 605 606 $revisions = wp_get_ post_revisions( $post->ID, array( 'posts_per_page' => 1 ));606 $revisions = wp_get_latest_revision_id_and_total_count( $post->ID ); 607 607 608 if ( 0 === count( $revisions )) {608 if ( is_wp_error( $revisions ) || 0 === $revisions['count'] ) { 609 609 return null; 610 610 } 611 611 612 $revision = reset( $revisions ); 613 return get_edit_post_link( $revision ); 612 return get_edit_post_link( $revisions['latest_id'] ); 614 613 } 615 614 616 615 /** -
src/wp-includes/theme.php
2068 2068 } 2069 2069 2070 2070 // Trigger creation of a revision. This should be removed once #30854 is resolved. 2071 if ( 0 === count( wp_get_post_revisions( $r ) ) ) { 2071 $revisions = wp_get_latest_revision_id_and_total_count( $r ); 2072 if ( ! is_wp_error( $revisions ) && 0 === $revisions['count'] ) { 2072 2073 wp_save_post_revision( $r ); 2073 2074 } 2074 2075 }