WP_REST_Revisions_Controller::__construct()publicWP 4.7.0

Constructor.

Method of the class: WP_REST_Revisions_Controller{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_REST_Revisions_Controller = new WP_REST_Revisions_Controller();
$WP_REST_Revisions_Controller->__construct( $parent_post_type );
$parent_post_type(string) (required)
Post type of the parent.

Changelog

Since 4.7.0 Introduced.

WP_REST_Revisions_Controller::__construct() code WP 6.5.2

public function __construct( $parent_post_type ) {
	$this->parent_post_type = $parent_post_type;
	$post_type_object       = get_post_type_object( $parent_post_type );
	$parent_controller      = $post_type_object->get_rest_controller();

	if ( ! $parent_controller ) {
		$parent_controller = new WP_REST_Posts_Controller( $parent_post_type );
	}

	$this->parent_controller = $parent_controller;
	$this->rest_base         = 'revisions';
	$this->parent_base       = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;
	$this->namespace         = ! empty( $post_type_object->rest_namespace ) ? $post_type_object->rest_namespace : 'wp/v2';
	$this->meta              = new WP_REST_Post_Meta_Fields( $parent_post_type );
}