WP_REST_Menu_Items_Controller::get_nav_menu_item() WordPress Method
The WP_REST_Menu_Items_Controller::get_nav_menu_item() method is used to retrieve a single navigation menu item. The menu item is specified by its ID.
WP_REST_Menu_Items_Controller::get_nav_menu_item( int $id ) #
Get the nav menu item, if the ID is valid.
Parameters
- $id
(int)(Required)Supplied ID.
Return
(object|WP_Error) Post object if ID is valid, WP_Error otherwise.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
protected function get_nav_menu_item( $id ) { $post = $this->get_post( $id ); if ( is_wp_error( $post ) ) { return $post; } return wp_setup_nav_menu_item( $post ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.9.0 | Introduced. |