wp_post_revisions_to_keep filter-hookWP 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.

This is one of the variants of the dynamic hook wp_(post_type)_revisions_to_keep

Usage

add_filter( 'wp_post_revisions_to_keep', 'wp_kama_post_revisions_to_keep_filter', 10, 2 );

/**
 * Function for `wp_post_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_revisions_to_keep_filter( $num, $post ){

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

Changelog

Since 5.8.0 Introduced.

Where the hook is called

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

Where the hook is used in WordPress

Usage not found.