_wp_get_post_revision_version

Gets the post revision version.

Description

(int|false) _wp_get_post_revision_version( (WP_Post) $revision ); 

Returns (int|false)

Parameters (1)

0. $revision (WP_Post)
The revision.

Usage

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

Defined (1)

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

/wp-includes/revision.php  
  1. function _wp_get_post_revision_version( $revision ) { 
  2. if ( is_object( $revision ) ) 
  3. $revision = get_object_vars( $revision ); 
  4. elseif ( !is_array( $revision ) ) 
  5. return false; 
  6.  
  7. if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) 
  8. return (int) $matches[1]; 
  9.  
  10. return 0;