WP_REST_Menus_Controller::get_menu_locations() – Returns the names of the locations assigned to the menu.
You appear to be a bot. Output may be restricted
Description
Returns the names of the locations assigned to the menu.
Usage
$string[] = WP_REST_Menus_Controller::get_menu_locations( $menu_id );
Parameters
- $menu_id
- ( int ) required – The menu id.
Returns
string[] The locations assigned to the menu.
Source
File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
Lines:
1 to 13 of 13
protected function get_menu_locations( $menu_id ) { $locations = get_nav_menu_locations(); $menu_locations = array(); foreach ( $locations as $location => $assigned_menu_id ) { if ( $menu_id === $assigned_menu_id ) { $menu_locations[] = $location; } } return $menu_locations; }