WP_REST_Autosaves_Controller::get_parent() WordPress Method

The WP_REST_Autosaves_Controller::get_parent() method gets the autosave parent for a given post. This is useful for getting the autosave parent for a post that has been updated with new content.

WP_REST_Autosaves_Controller::get_parent( int $parent_id ) #

Get the parent post.


Parameters

$parent_id

(int)(Required)Supplied ID.


Top ↑

Return

(WP_Post|WP_Error) Post object if ID is valid, WP_Error otherwise.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

	protected function get_parent( $parent_id ) {
		return $this->revisions_controller->get_parent( $parent_id );
	}


Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.