WP_REST_Controller::get_object_type()protectedWP 4.7.0

Retrieves the object type this controller is responsible for managing.

Method of the class: WP_REST_Controller{}

No Hooks.

Return

String. Object type for the controller.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_object_type();

Changelog

Since 4.7.0 Introduced.

WP_REST_Controller::get_object_type() code WP 6.5.2

protected function get_object_type() {
	$schema = $this->get_item_schema();

	if ( ! $schema || ! isset( $schema['title'] ) ) {
		return null;
	}

	return $schema['title'];
}