Title: WP_REST_Menu_Items_Controller::get_schema_links
Published: February 3, 2022
Last modified: February 24, 2026

---

# WP_REST_Menu_Items_Controller::get_schema_links(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#wp--skip-link--target)

Retrieves Link Description Objects that should be added to the Schema for the nav
menu items collection.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#return)󠁿

 array

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#source)󠁿

    ```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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php#L702)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php#L702-L720)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_REST_Posts_Controller::get_schema_links()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/get_schema_links/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

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

  | 
| [rest_url()](https://developer.wordpress.org/reference/functions/rest_url/)`wp-includes/rest-api.php` |

Retrieves the URL to a REST endpoint.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#)

| Used by | Description | 
| [WP_REST_Menu_Items_Controller::get_item_schema()](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_item_schema/)`wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php` |

Retrieves the nav menu item’s schema, conforming to JSON Schema.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/get_schema_links/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_menu_items_controller%2Fget_schema_links%2F)
before being able to contribute a note or feedback.