wp_is_post_revision

Determines if the specified post is a revision.

Description

(false|int) wp_is_post_revision( (int|WP_Post) $post ); 

Returns (false|int)

False if not a revision, ID of revision's parent otherwise.

Parameters (1)

0. $post (int|WP_Post)
Post ID or post object.

Usage

  1. if ( !function_exists( 'wp_is_post_revision' ) ) { 
  2. require_once ABSPATH . WPINC . '/revision.php'; 
  3.  
  4. // Post ID or post object. 
  5. $post = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_is_post_revision($post); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/revision.php  
  1. function wp_is_post_revision( $post ) { 
  2. if ( !$post = wp_get_post_revision( $post ) ) 
  3. return false; 
  4.  
  5. return (int) $post->post_parent;