Make WordPress Core


Ignore:
Timestamp:
08/05/2022 01:00:57 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Revisions: Use latest_id as the array key for the latest revision ID.

This updates wp_get_latest_revision_id_and_total_count() and its usage to be a bit more descriptive and a bit less repetitive, e.g. $revisions['latest_id'] instead of $revision['revision'].

Includes updating the @return tag to explain when the function returns a WP_Error.

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

See #55857.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/revisions.php

    r53778 r53841  
    676676                $post_revisions       = wp_get_post_revisions( $post_id );
    677677                $latest_post_revision = current( $post_revisions );
    678                 $revision             = wp_get_latest_revision_id_and_total_count( $post_id );
     678                $revisions            = wp_get_latest_revision_id_and_total_count( $post_id );
    679679
    680680                $this->assertSame(
    681681                        $latest_post_revision->ID,
    682                         $revision['revision'],
     682                        $revisions['latest_id'],
    683683                        'The latest revision ID does not match.'
    684684                );
     
    686686                $this->assertSame(
    687687                        count( $post_revisions ),
    688                         $revision['count'],
     688                        $revisions['count'],
    689689                        'The total count of revisions does not match.'
    690690                );
Note: See TracChangeset for help on using the changeset viewer.