WP_REST_Plugins_Controller::prepare_links()protectedWP 5.5.0

Prepares links for the request.

Method of the class: WP_REST_Plugins_Controller{}

No Hooks.

Return

Array[].

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $item );
$item(array) (required)
The plugin item.

Changelog

Since 5.5.0 Introduced.

WP_REST_Plugins_Controller::prepare_links() code WP 6.5.2

protected function prepare_links( $item ) {
	return array(
		'self' => array(
			'href' => rest_url(
				sprintf(
					'%s/%s/%s',
					$this->namespace,
					$this->rest_base,
					substr( $item['_file'], 0, - 4 )
				)
			),
		),
	);
}