Make WordPress Core


Ignore:
Timestamp:
07/23/2022 03:40:10 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Revisions: Correct the function name for retrieving the last revision ID and total count.

Includes:

  • Renaming the function to wp_get_last_revision_id_and_total_count().
  • Making the default value for $post consistent with wp_get_post_revisions().
  • Making WP_Error codes more specific and using them in test assertions.
  • Adjusting the function description per the documentation standards.

Follow-up to [53759].

Props JustinSainton, SergeyBiryukov.
See #55857.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r53760 r53769  
    20272027
    20282028        if ( in_array( $post->post_type, array( 'post', 'page' ), true ) || post_type_supports( $post->post_type, 'revisions' ) ) {
    2029             $revision        = wp_get_lastest_revision_id_and_total_count( $post->ID );
     2029            $revision        = wp_get_last_revision_id_and_total_count( $post->ID );
    20302030            $revisions_count = ! is_wp_error( $revision ) ? $revision['count'] : 0;
    20312031
     
    20362036
    20372037            if ( $revisions_count > 0 ) {
    2038                 $last_revision                = $revision['revision'];
     2038                $last_revision = $revision['revision'];
     2039
    20392040                $links['predecessor-version'] = array(
    20402041                    'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions/' . $last_revision ),
Note: See TracChangeset for help on using the changeset viewer.