wp_(post_type)_revisions_to_keep хук-фильтрWP 5.8.0

Filters the number of revisions to save for the given post by its post type.

Overrides both the value of WP_POST_REVISIONS and the wp_revisions_to_keep filter.

The dynamic portion of the hook name, $post->post_type, refers to the post type slug.

Possible hook names include:

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

add_filter( 'wp_(post_type)_revisions_to_keep', 'wp_kama_post_type_revisions_to_keep_filter', 10, 2 );

/**
 * Function for `wp_(post_type)_revisions_to_keep` filter-hook.
 * 
 * @param int     $num  Number of revisions to store.
 * @param WP_Post $post Post object.
 *
 * @return int
 */
function wp_kama_post_type_revisions_to_keep_filter( $num, $post ){

	// filter...
	return $num;
}
$num(int)
Number of revisions to store.
$post(WP_Post)
Post object.

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

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

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

wp_revisions_to_keep()
wp_(post_type)_revisions_to_keep
wp-includes/revision.php 621
$num = apply_filters( "wp_{$post->post_type}_revisions_to_keep", $num, $post );

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

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