WP_REST_Menu_Items_Controller::get_nav_menu_item() – Get the nav menu item, if the ID is valid.

You appear to be a bot. Output may be restricted

Description

Get the nav menu item, if the ID is valid.

Usage

$object|WP_Error = WP_REST_Menu_Items_Controller::get_nav_menu_item( $id );

Parameters

$id
( int ) required – Supplied ID.

Returns

object|WP_Error Post object if ID is valid, WP_Error otherwise.

Source

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


Lines:

1 to 9 of 9
  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 );
  }
 

 View on GitHub View on Trac