if ( !
wp_revisions_enabled( $post ) ) { return;
} /*
* Compare the proposed update with the last stored revision verifying that
* they are different, unless a plugin tells us to always save regardless.
* If no previous revisions, save one.
*/
$revisions =
wp_get_post_revisions( $post_id );
if ( $revisions ) { // Grab the latest revision, but not an autosave.
foreach ( $revisions as $revision ) { if ( str_contains( $revision->post_name, "{
$revision->post_parent
}-revision"
) ) { $latest_revision =
$revision;
break;
} } /**
* 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.
*
* @since 3.6.0
*
* @param bool $check_for_changes Whether to check for changes before saving a new revision.
* Default true.
* @param WP_Post $latest_revision The latest revision post object.
* @param WP_Post $post The post object.
*/