WP_REST_Autosaves_Controller::__construct( string $parent_post_type )

Constructor.


Description Description


Parameters Parameters

$parent_post_type

(string) (Required) Post type of the parent.


Top ↑

Source Source

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

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

		// Ensure that post type-specific controller logic is available.
		$parent_controller_class = ! empty( $post_type_object->rest_controller_class ) ? $post_type_object->rest_controller_class : 'WP_REST_Posts_Controller';

		$this->parent_controller    = new $parent_controller_class( $post_type_object->name );
		$this->revisions_controller = new WP_REST_Revisions_Controller( $parent_post_type );
		$this->rest_namespace       = 'wp/v2';
		$this->rest_base            = 'autosaves';
		$this->parent_base          = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.