wp_save_post_revision_check_for_changes
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.
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 $latest_revision The latest 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, $latest_revision, $post ){
// filter...
return $check_for_changes;
}
- $check_for_changes(true|false)
- Whether to check for changes before saving a new revision.
Default: true - $latest_revision(WP_Post)
- The latest revision post object.
- $post(WP_Post)
- The post object.
Changelog
| Since 3.6.0 | Introduced. |
Where the hook is called
wp_save_post_revision_check_for_changes
wp-includes/revision.php 186
if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) {