Make WordPress Core

Changeset 53779


Ignore:
Timestamp:
07/25/2022 07:28:29 PM (20 months ago)
Author:
SergeyBiryukov
Message:

Revisions: Update the "last revision" wording to "latest revision" in various files.

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.

This affects:

  • wp_save_post_revision()
  • wp_prepare_revisions_for_js()
  • WP_Customize_Manager::filter_revision_post_has_changed()

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

Props peterwilsoncc.
Fixes #55857.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/revision.php

    r52332 r53779  
    301301
    302302    /*
    303      * If a post has been saved since the last revision (no revisioned fields
     303     * If a post has been saved since the latest revision (no revisioned fields
    304304     * were changed), we may not have a "current" revision. Mark the latest
    305305     * revision as "current".
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r53455 r53779  
    34283428     *
    34293429     * @param bool    $post_has_changed Whether the post has changed.
    3430      * @param WP_Post $last_revision    The last revision post object.
     3430     * @param WP_Post $latest_revision  The latest revision post object.
    34313431     * @param WP_Post $post             The post object.
    34323432     * @return bool Whether a revision should be made.
    34333433     */
    3434     public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) {
    3435         unset( $last_revision );
     3434    public function _filter_revision_post_has_changed( $post_has_changed, $latest_revision, $post ) {
     3435        unset( $latest_revision );
    34363436        if ( 'customize_changeset' === $post->post_type ) {
    34373437            $post_has_changed = $this->store_changeset_revision;
  • trunk/src/wp-includes/revision.php

    r53778 r53779  
    137137    $revisions = wp_get_post_revisions( $post_id );
    138138    if ( $revisions ) {
    139         // Grab the last revision, but not an autosave.
     139        // Grab the latest revision, but not an autosave.
    140140        foreach ( $revisions as $revision ) {
    141141            if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
    142                 $last_revision = $revision;
     142                $latest_revision = $revision;
    143143                break;
    144144            }
     
    146146
    147147        /**
    148          * Filters whether the post has changed since the last revision.
     148         * Filters whether the post has changed since the latest revision.
    149149         *
    150150         * By default a revision is saved only if one of the revisioned fields has changed.
     
    155155         * @param bool    $check_for_changes Whether to check for changes before saving a new revision.
    156156         *                                   Default true.
    157          * @param WP_Post $last_revision     The last revision post object.
     157         * @param WP_Post $latest_revision   The latest revision post object.
    158158         * @param WP_Post $post              The post object.
    159159         */
    160         if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) {
     160        if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) {
    161161            $post_has_changed = false;
    162162
    163163            foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
    164                 if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) {
     164                if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) {
    165165                    $post_has_changed = true;
    166166                    break;
     
    177177             *
    178178             * @param bool    $post_has_changed Whether the post has changed.
    179              * @param WP_Post $last_revision    The last revision post object.
     179             * @param WP_Post $latest_revision  The latest revision post object.
    180180             * @param WP_Post $post             The post object.
    181181             */
    182             $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
     182            $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $latest_revision, $post );
    183183
    184184            // Don't save revision if post unchanged.
Note: See TracChangeset for help on using the changeset viewer.