wp_save_post_revision_check_for_changes хук-фильтрWP 3.6.0

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.

Использование

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.
По умолчанию: true
$latest_revision(WP_Post)
The latest revision post object.
$post(WP_Post)
The post object.

Список изменений

С версии 3.6.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

Использование не найдено.