wp_revisions_enabled()WP 3.6.0

Determine if revisions are enabled for a given post.

No Hooks.

Return

true|false. True if number of revisions to keep isn't zero, false otherwise.

Usage

wp_revisions_enabled( $post );
$post(WP_Post) (required)
The post object.

Examples

0

#1 Check if the revisions for specified post are enabled

$post = get_post( 1 );

if( wp_revisions_enabled( $post ) ){
	echo 'Revisions are enabled for this post';
}
else {
	echo 'The revision posts are disabled for this one';
}

Changelog

Since 3.6.0 Introduced.

wp_revisions_enabled() code WP 6.6.2

function wp_revisions_enabled( $post ) {
	return wp_revisions_to_keep( $post ) !== 0;
}