Definition:
function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {}
Gets a post revision.
Parameters
- int|object $post: Post ID or post object
- string $output: Optional. OBJECT, ARRAY_A, or ARRAY_N.
- string $filter: Optional sanitation filter. @see sanitize_post()
- &$post
Return values
returns:Null if error or post object if success
Source code
function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
$null = null;
if ( !$revision = get_post( $post, OBJECT, $filter ) )
return $revision;
if ( 'revision' !== $revision->post_type )
return $null;
if ( $output == OBJECT ) {
return $revision;
} elseif ( $output == ARRAY_A ) {
$_revision = get_object_vars($revision);
return $_revision;
} elseif ( $output == ARRAY_N ) {
$_revision = array_values(get_object_vars($revision));
return $_revision;
}
return $revision;
}
3733

February 12, 2011 


No comments yet... Be the first to leave a reply!