wp_revisions_enabled()
Check if revisions are enabled for the specified post.
Used By: wp_save_post_revision()
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
#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() wp revisions enabled code WP 6.9.1
function wp_revisions_enabled( $post ) {
return wp_revisions_to_keep( $post ) !== 0;
}