Ticket #56279: 56279.2.diff
File 56279.2.diff, 1.7 KB (added by , 2 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['revision'], 1469 1469 '__back_compat_meta_box' => true, 1470 1470 ); 1471 1471 -
src/wp-includes/revision.php
602 602 return null; 603 603 } 604 604 605 $revisions = wp_get_ post_revisions( $post->ID, array( 'posts_per_page' => 1 ));605 $revisions = wp_get_latest_revision_id_and_total_count( $post->ID ); 606 606 607 if ( 0 === count( $revisions )) {607 if ( is_wp_error( $revisions ) || 0 === $revisions['count'] ) { 608 608 return null; 609 609 } 610 610 611 $revision = reset( $revisions ); 612 return get_edit_post_link( $revision ); 611 return get_edit_post_link( $revisions['revision'] ); 613 612 } 614 613 615 614 /**