WP_REST_Menu_Items_Controller::get_schema_links
Retrieves Link Description Objects that should be added to the Schema for the nav menu items collection.
Method of the class: WP_REST_Menu_Items_Controller{}
No Hooks.
Returns
Array.
Usage
// protected - for code of main (parent) or child class $result = $this->get_schema_links();
Changelog
| Since 5.9.0 | Introduced. |
WP_REST_Menu_Items_Controller::get_schema_links() WP REST Menu Items Controller::get schema links code WP 7.0
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;
}