Ticket #56279: 56279.diff
File 56279.diff, 2.1 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_last_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
584 584 * @since 5.9.0 585 585 * 586 586 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. 587 * @return null|stringThe URL for editing revisions on the given post, otherwise null.587 * @return string|null The URL for editing revisions on the given post, otherwise null. 588 588 */ 589 589 function wp_get_post_revisions_url( $post = 0 ) { 590 590 $post = get_post( $post ); … … 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_last_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 $last_revision = $revisions['revision']; 612 ; 613 return get_edit_post_link( $last_revision ); 613 614 } 614 615 615 616 /**