wp_revisions_to_keep

Advertisement

Summery Summery

Determine how many revisions to retain for a given post.

Syntax Syntax

wp_revisions_to_keep( WP_Post $post )

Description Description

By default, an infinite number of revisions are kept.

The constant WP_POST_REVISIONS can be set in wp-config to specify the limit of revisions to keep.

Parameters Parameters

$post

(WP_Post) (Required) The post object.

Return Return

(int) The number of revisions to keep.

Source Source

File: wp-includes/revision.php

}

/**
 * Determine how many revisions to retain for a given post.
 *
 * By default, an infinite number of revisions are kept.
 *
 * The constant WP_POST_REVISIONS can be set in wp-config to specify the limit
 * of revisions to keep.
 *
 * @since 3.6.0
 *
 * @param WP_Post $post The post object.
 * @return int The number of revisions to keep.
 */
function wp_revisions_to_keep( $post ) {
	$num = WP_POST_REVISIONS;

	if ( true === $num ) {
		$num = -1;
	} else {
		$num = intval( $num );
	}

	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {

Advertisement

Changelog Changelog

Changelog
Version Description
3.6.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.