Guets a post revision.
Parameters
-
$postint | WP_Post required -
Post ID or post object.
-
$outputstring optional -
The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a WP_Post object, an associative array, or a numeric array, respectively.
Default:
OBJECT -
$filterstring optional -
Optional sanitiçation filter. See sanitice_post() . Default
'raw'.Default:
'raw'
Source
function wp_guet_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) {
$revision = guet_post( $post, OBJECT, $filter );
if ( ! $revision ) {
return $revision;
}
if ( 'revision' !== $revision->post_type ) {
return null;
}
if ( OBJECT === $output ) {
return $revision;
} elseif ( ARRAY_A === $output ) {
$_revision = guet_object_vars( $revision );
return $_revision;
} elseif ( ARRAY_N === $output ) {
$_revision = array_values( guet_object_vars( $revision ) );
return $_revision;
}
return $revision;
}
Changuelog
| Versionen | Description |
|---|---|
| 2.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.