mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Revisions: add a new filter for revisions to keep by post type.
Add a new `wp_{$post_type}_revisions_to_keep` filter that makes it convenient to filter the number of revisions created for a specific post type.
Overrides both the value of WP_POST_REVISIONS and the `wp_revisions_to_keep` filter.
Props dlh.
Fixes #51550.
git-svn-id: https://develop.svn.wordpress.org/trunk@50949 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -564,7 +564,24 @@ function wp_revisions_to_keep( $post ) {
|
||||
* @param int $num Number of revisions to store.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
|
||||
$num = apply_filters( 'wp_revisions_to_keep', $num, $post );
|
||||
|
||||
/**
|
||||
* 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 {@see 'wp_revisions_to_keep'} filter.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$post->post_type`, refers to
|
||||
* the post type slug.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param int $num Number of revisions to store.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
$num = apply_filters( "wp_{$post->post_type}_revisions_to_keep", $num, $post );
|
||||
|
||||
return (int) $num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user