wppaste
WordPress

apply_filters( 'wp_save_post_revision_check_for_changes', bool $check_for_changes, WP_Post $latest_revision, WP_Post $post )

Since
3.6.0
Filters whether the post has changed since the latest revision.

Description

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.

Compatibility

WordPress
since 3.6.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$check_for_changesbool
Whether to check for changes before saving a new revision.
Default true.
$latest_revisionWP_Post
The latest revision post object.
$postWP_Post
The post object.

Where this hook fires · 1

  • wp-includes/revision.php:186wp_save_post_revision()

Source code

		 *		 * @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.		 */		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( $latest_revision->$field ) ) {					$post_has_changed = true;					break;

Changelog

Introduced in 3.6.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.