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

Top ↑

Parameters

$num

(int)Number of revisions to store.

$post

(WP_Post)Post object.


Top ↑

Source

File: wp-includes/revision.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.