WP_REST_Menu_Items_Controller::get_schema_links() WordPress Method

The WP_REST_Menu_Items_Controller::get_schema_links() method is used to get the links for the REST API schema.

WP_REST_Menu_Items_Controller::get_schema_links() #

Retrieve Link Description Objects that should be added to the Schema for the posts collection.


Return

(array)


Top ↑

Source

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

	protected function get_schema_links() {
		$links   = parent::get_schema_links();
		$href    = rest_url( "{$this->namespace}/{$this->rest_base}/{id}" );
		$links[] = array(
			'rel'          => 'https://api.w.org/menu-item-object',
			'title'        => __( 'Get linked object.' ),
			'href'         => $href,
			'targetSchema' => array(
				'type'       => 'object',
				'properties' => array(
					'object' => array(
						'type' => 'integer',
					),
				),
			),
		);

		return $links;
	}


Top ↑

Changelog

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