wp_page_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


add_filter( 'wp_page_revisions_to_keep', 'wp_kama_page_revisions_to_keep_filter', 10, 2 );

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

	// filter...
	return $num;
Number of revisions to store.
Post object.


Since 5.8.0 Introduced.

Where the hook is called

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

Where the hook is used in WordPress

Usage not found.