wp_revisions_enabled()WP 3.6.0

Check if revisions are enabled for the specified post.

No Hooks.

Returns

true|false. True, if revisions are enabled for the post, false - otherwise.

Usage

wp_revisions_enabled( $post );
$post(WP_Post) (required)
Object of the post - WP_Post.

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.9.1

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