WP_REST_Plugins_Controller::prepare_links() WordPress Method

The WP_REST_Plugins_Controller::prepare_links() method is used to prepare the links for a plugin. This is typically done before the plugin is registered with the WordPress REST API.

WP_REST_Plugins_Controller::prepare_links( array $item ) #

Prepares links for the request.


Parameters

$item

(array)(Required)The plugin item.


Top ↑

Return

(array[])


Top ↑

Source

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

	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 ) ) ),
			),
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
5.5.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.