wp_is_post_revision() WordPress Function
The wp_is_post_revision() function allows you to check if the current post is a revision. This function is useful for making sure that you are only making changes to the most recent version of a post.
wp_is_post_revision( int|WP_Post $post ) #
Determines if the specified post is a revision.
Parameters
- $post
(int|WP_Post)(Required)Post ID or post object.
Return
(int|false) ID of revision's parent on success, false if not a revision.
Source
File: wp-includes/revision.php
function wp_is_post_revision( $post ) { $post = wp_get_post_revision( $post ); if ( ! $post ) { return false; } return (int) $post->post_parent; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |