wp_{$post->post_type}_revisions_to_keep WordPress Filter Hook
The wp_{$post->post_type}_revisions_to_keep hook is used to specify the number of revisions to keep for a given post type. This hook is called when a post is saved, and the value returned by the hook is used to determine how many revisions to keep for that post type.
apply_filters( "wp_{$post->post_type}_revisions_to_keep", int $num , WP_Post $post ) #
Filters the number of revisions to save for the given post by its post type.
Description
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:
wp_post_revisions_to_keep
wp_page_revisions_to_keep
Parameters
- $num
(int)Number of revisions to store.
- $post
(WP_Post)Post object.
Source
File: wp-includes/revision.php
Changelog
Version | Description |
---|---|
5.8.0 | Introduced. |