wp_revisions_enabled()
Determine if revisions are enabled for a given post.
Used By: wp_save_post_revision()
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
#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.6.2
function wp_revisions_enabled( $post ) { return wp_revisions_to_keep( $post ) !== 0; }