Make WordPress Core


Ignore:
Timestamp:
07/25/2022 07:18:41 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Revisions: Rename the function for retrieving the latest revision ID and total count.

The new name is wp_get_latest_revision_id_and_total_count().

This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc.

Follow-up to [53759], [53769].

Props peterwilsoncc.
See #55857.

File:
1 edited

Legend:

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

    r53769 r53778  
    20272027
    20282028        if ( in_array( $post->post_type, array( 'post', 'page' ), true ) || post_type_supports( $post->post_type, 'revisions' ) ) {
    2029             $revision        = wp_get_last_revision_id_and_total_count( $post->ID );
     2029            $revision        = wp_get_latest_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                $latest_revision = $revision['revision'];
    20392039
    20402040                $links['predecessor-version'] = array(
    2041                     'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions/' . $last_revision ),
    2042                     'id'   => $last_revision,
     2041                    'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions/' . $latest_revision ),
     2042                    'id'   => $latest_revision,
    20432043                );
    20442044            }
Note: See TracChangeset for help on using the changeset viewer.