WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp is post autosave

Description

Determines if the specified post is an autosave.

Usage

<?php wp_is_post_autosave$post_id ); ?>

Parameters

$post
(int/object) (required) Post ID or post object.
Default: None

Return Values

(boolean/integer) 
Boolean false if not a revision, ID of autosave's parent otherwise.

Example

Check if a saved post is an autosave post, like saving meta box data.

<?php

// If post is an autosave, return
if ( wp_is_post_autosave( $post_id ) ) {
	
	return;

}

?>

Change Log

Since: 2.6.0

Source File

wp_is_post_autosave() is defined in wp-includes/revision.php

Related

wp_get_post_revision()

See also index of Function Reference and index of Template Tags.
This article is marked as in need of editing. You can help Codex by editing it.