wp_revisions_to_keep WordPress Filter Hook

The wp_revisions_to_keep hook is used to specify the number of revision copies to keep for a post. By default, WordPress keeps 5 revision copies for a post, but this number can be increased or decreased by specifying a different number using this hook.

apply_filters( 'wp_revisions_to_keep', int $num, WP_Post $post ) #

Filters the number of revisions to save for the given post.


Description

Overrides the value of WP_POST_REVISIONS.


Top ↑

Parameters

$num

(int)Number of revisions to store.

$post

(WP_Post)Post object.


Top ↑

More Information

  • By default, an infinite number of revisions are stored if a post type supports revisions.
  • Note that the filter callback functions must return a value after it is finished processing or the revisions will be empty.

Top ↑

Source

File: wp-includes/revision.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.6.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.