WP_REST_Menu_Locations_Controller::get_items() – Retrieves all menu locations, depending on user context.

You appear to be a bot. Output may be restricted

Description

Retrieves all menu locations, depending on user context.

Usage

$WP_Error|WP_REST_Response = WP_REST_Menu_Locations_Controller::get_items( $request );

Parameters

$request
( WP_REST_Request ) required – Full details about the request.

Returns

WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.

Source

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


Lines:

1 to 15 of 15
  public function get_items( $request ) {
    $data = array();

    foreach ( get_registered_nav_menus() as $name => $description ) {
      $location              = new stdClass();
      $location->name        = $name;
      $location->description = $description;

      $location      = $this->prepare_item_for_response( $location, $request );
      $data[ $name ] = $this->prepare_response_for_collection( $location );
    }

    return rest_ensure_response( $data );
  }
 

 View on GitHub View on Trac