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. Built from https://develop.svn.wordpress.org/trunk@53779 git-svn-id: http://core.svn.wordpress.org/trunk@53338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
adb5ff451c
commit
87464289c3
|
@ -300,7 +300,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
|
|||
}
|
||||
|
||||
/*
|
||||
* If a post has been saved since the last revision (no revisioned fields
|
||||
* If a post has been saved since the latest revision (no revisioned fields
|
||||
* were changed), we may not have a "current" revision. Mark the latest
|
||||
* revision as "current".
|
||||
*/
|
||||
|
|
|
@ -3427,12 +3427,12 @@ final class WP_Customize_Manager {
|
|||
* @since 4.7.0
|
||||
*
|
||||
* @param bool $post_has_changed Whether the post has changed.
|
||||
* @param WP_Post $last_revision The last revision post object.
|
||||
* @param WP_Post $latest_revision The latest revision post object.
|
||||
* @param WP_Post $post The post object.
|
||||
* @return bool Whether a revision should be made.
|
||||
*/
|
||||
public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) {
|
||||
unset( $last_revision );
|
||||
public function _filter_revision_post_has_changed( $post_has_changed, $latest_revision, $post ) {
|
||||
unset( $latest_revision );
|
||||
if ( 'customize_changeset' === $post->post_type ) {
|
||||
$post_has_changed = $this->store_changeset_revision;
|
||||
}
|
||||
|
|
|
@ -136,16 +136,16 @@ function wp_save_post_revision( $post_id ) {
|
|||
*/
|
||||
$revisions = wp_get_post_revisions( $post_id );
|
||||
if ( $revisions ) {
|
||||
// Grab the last revision, but not an autosave.
|
||||
// Grab the latest revision, but not an autosave.
|
||||
foreach ( $revisions as $revision ) {
|
||||
if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
|
||||
$last_revision = $revision;
|
||||
$latest_revision = $revision;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters whether the post has changed since the last revision.
|
||||
* Filters whether the post has changed since the latest revision.
|
||||
*
|
||||
* By default a revision is saved only if one of the revisioned fields has changed.
|
||||
* This filter can override that so a revision is saved even if nothing has changed.
|
||||
|
@ -154,14 +154,14 @@ function wp_save_post_revision( $post_id ) {
|
|||
*
|
||||
* @param bool $check_for_changes Whether to check for changes before saving a new revision.
|
||||
* Default true.
|
||||
* @param WP_Post $last_revision The last revision post object.
|
||||
* @param WP_Post $latest_revision The latest revision post object.
|
||||
* @param WP_Post $post The post object.
|
||||
*/
|
||||
if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) {
|
||||
if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) {
|
||||
$post_has_changed = false;
|
||||
|
||||
foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
|
||||
if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) {
|
||||
if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) {
|
||||
$post_has_changed = true;
|
||||
break;
|
||||
}
|
||||
|
@ -176,10 +176,10 @@ function wp_save_post_revision( $post_id ) {
|
|||
* @since 4.1.0
|
||||
*
|
||||
* @param bool $post_has_changed Whether the post has changed.
|
||||
* @param WP_Post $last_revision The last revision post object.
|
||||
* @param WP_Post $latest_revision The latest revision post object.
|
||||
* @param WP_Post $post The post object.
|
||||
*/
|
||||
$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
|
||||
$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $latest_revision, $post );
|
||||
|
||||
// Don't save revision if post unchanged.
|
||||
if ( ! $post_has_changed ) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53778';
|
||||
$wp_version = '6.1-alpha-53779';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue