wp_revisions_to_keep
Filters the number of revisions to save for the given post.
Overrides the value of WP_POST_REVISIONS.
Usage
add_filter( 'wp_revisions_to_keep', 'wp_kama_revisions_to_keep_filter', 10, 2 ); /** * Function for `wp_revisions_to_keep` filter-hook. * * @param int $num Number of revisions to store. * @param WP_Post $post Post object. * * @return int */ function wp_kama_revisions_to_keep_filter( $num, $post ){ // filter... return $num; }
- $num(int)
- Number of revisions to store.
- $post(WP_Post)
- Post object.
Changelog
Since 3.6.0 | Introduced. |
Where the hook is called
wp_revisions_to_keep
wp-includes/revision.php 829
$num = apply_filters( 'wp_revisions_to_keep', $num, $post );