:abcd: Menu routes for WordPress JSON REST API.
/menuslist of every registered menu.
/menus/data for a specific menu.
/menu-locationslist of all registered theme locations.
/menu-locations/data for menu in specified menu in theme location.
menu-locations/route for individual menus will return a tree with full menu hierarchy, with correct menu item order and listing children for each menu item. The
menus/route will output menu details and a flat array of menu items. Item order or if each item has a parent will be indicated in each item attributes, but this route won't output items as a tree.
You can alter the V1 data arrangement of each individual menu items and children using the filter hook
In V1 of the REST API the routes are located by default at
In V2 the routes by default are at
wp-json/wp-api-menus/v2/menus/, etc.) since V2 encourages prefixing and version namespacing.
You can alter the V2 data arrangement of the REST response using the filter hooks 1.
rest_menus_format_menusto alter the list of menu items returned (e.g from
rest_menus_format_menuto alter a single menu returned (e.g
rest_menus_format_menu_itemto alter the menu items returned (e.g