WP_REST_Menu_Items_Controller::get_nav_menu_item()
Gets the nav menu item, if the ID is valid.
Method of the class: WP_REST_Menu_Items_Controller{}
No Hooks.
Return
Object|WP_Error
. Post object if ID is valid, WP_Error otherwise.
Usage
// protected - for code of main (parent) or child class $result = $this->get_nav_menu_item( $id );
- $id(int) (required)
- Supplied ID.
Changelog
Since 5.9.0 | Introduced. |
WP_REST_Menu_Items_Controller::get_nav_menu_item() WP REST Menu Items Controller::get nav menu item code WP 6.6.2
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 ); }