CP_Post_Revisions_List_Table::prepare_items()

Renders the list of revisions


Return

(string)


Source

File: wp-admin/includes/class-cp-post-revisions-list-table.php

	public function prepare_items() {
		$post_id = absint( $_GET['post_parent'] );
		$revisions = wp_get_post_revisions( $post_id );

		// Create an empty array
		$safe_revisions = array();

		// Find the key for the last revision
		$last_revision = reset( $revisions );

		// Fill the array with all the revisions except the most recent (to prevent its deletion)
		foreach ( $revisions as $key => $revision ) {
			if ( $revision->ID !== $last_revision->ID ) {
				$safe_revisions[] = $revision;
			}
		}
		$this->items = $safe_revisions;
	}

Changelog

Changelog
Version Description
CP-2.6.0 Introduced. CP-2.6.0