wp_get_post_revision

Advertisement

Summery Summery

Gets a post revision.

Syntax Syntax

wp_get_post_revision( int|WP_Post $post, string $output = OBJECT, string $filter = 'raw' )

Parameters Parameters

$post

(Required) The post ID or object.

$output

(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 value: OBJECT

$filter

(Optional) sanitation filter. See sanitize_post().

Default value: 'raw'

Return Return

(WP_Post|array|null) WP_Post (or array) on success, or null on failure.

Source Source

File: wp-includes/revision.php

	return $revision_id;
}

/**
 * Gets a post revision.
 *
 * @since 2.6.0
 *
 * @param int|WP_Post $post   The post ID or object.
 * @param string      $output 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.
 * @param string      $filter Optional sanitation filter. See sanitize_post().
 * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
 */
function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) {
	$revision = get_post( $post, OBJECT, $filter );
	if ( ! $revision ) {
		return $revision;
	}
	if ( 'revision' !== $revision->post_type ) {

Advertisement

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Advertisement

Leave a Reply