wp_save_post_revision_check_for_changes filter-hookWP 3.6.0

Filters whether the post has changed since the last 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.

Usage

add_filter( 'wp_save_post_revision_check_for_changes', 'wp_kama_save_post_revision_check_for_changes_filter', 10, 3 );

/**
 * Function for `wp_save_post_revision_check_for_changes` filter-hook.
 * 
 * @param bool    $check_for_changes Whether to check for changes before saving a new revision.
 * @param WP_Post $last_revision     The last revision post object.
 * @param WP_Post $post              The post object.
 *
 * @return bool
 */
function wp_kama_save_post_revision_check_for_changes_filter( $check_for_changes, $last_revision, $post ){

	// filter...
	return $check_for_changes;
}
$check_for_changes(true|false)
Whether to check for changes before saving a new revision.
Default: true
$last_revision(WP_Post)
The last revision post object.
$post(WP_Post)
The post object.

Changelog

Since 3.6.0 Introduced.

Where the hook is called

wp_save_post_revision()
wp_save_post_revision_check_for_changes
wp-includes/revision.php 159
if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) {

Where the hook is used in WordPress

Usage not found.