wp_is_post_autosave( int|WP_Post $post )
Determines if the specified post is an autosave.
Parameters
- $post
-
(Required) Post ID or post object.
Return
(false|int) False if not a revision, ID of autosave's parent otherwise
Source
File: wp-includes/revision.php
function wp_is_post_autosave( $post ) {
if ( !$post = wp_get_post_revision( $post ) )
return false;
if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
return (int) $post->post_parent;
return false;
}
Changelog
Version | Description |
---|---|
WP-2.6.0 | Introduced. |