Advertisements

wp_get_post_revisions

Definition:
function wp_get_post_revisions( $post_id = 0, $args = null ) {}

Returns all revisions of specified post.

Parameters

  • int|object $post_id: Post ID or post object
  • $args

Return values

returns:empty if no revisions

Source code

function wp_get_post_revisions( $post_id = 0, $args = null ) {

	if ( ! WP_POST_REVISIONS )

		return array();

	if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) )

		return array();



	$defaults = array( 'order' => 'DESC', 'orderby' => 'date' );

	$args = wp_parse_args( $args, $defaults );

	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );



	if ( !$revisions = get_children( $args ) )

		return array();

	return $revisions;

}

3735

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: