- Notifications
You must be signed in to change notification settings - Fork58
🔡 Menu routes for WordPress JSON REST API.
License
unfulvio/wp-api-menus
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
WordPress plugin that extends the JSON RESTWP API with new routes pointing to WordPress registered menus. Read theWP API documentation.
/menuslist of every registered menu./menus/<id>data for a specific menu./menu-locationslist of all registered theme locations./menu-locations/<location>data for menu in specified menu in theme location.
Currently, themenu-locations/<location> route for individual menus will return a tree with full menu hierarchy, with correct menu item order and listing children for each menu item. Themenus/<id> 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 hookjson_menus_format_menu_item.
In V1 of the REST API the routes are located by default atwp-json/menus/ etc.
In V2 the routes by default are atwp-json/wp-api-menus/v2/ (e.g.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
rest_menus_format_menusto alter the list of menu items returned (e.g fromwp-json/wp-api-menus/v2/menus/)rest_menus_format_menuto alter a single menu returned (e.gwp-json/wp-api-menus/v2/menus/<id>)rest_menus_format_menu_itemto alter the menu items returned (e.gwp-json/wp-api-menus/v2/menus/<id>itemsproperty)
- Submit a pull request or open a ticket here on GitHub.
About
🔡 Menu routes for WordPress JSON REST API.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors15
Uh oh!
There was an error while loading.Please reload this page.

