Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Menu routes for WordPress JSON REST API.
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead, 22 commits behind unfulvio:master.
Cannot retrieve the latest commit at this time.
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.editorconfig
.gitattributes
.gitignore
.scutinizer.yml
CHANGELOG.md
Gruntfile.js
README.md
composer.json
index.php
license.txt
package.json
wp-api-menus.php

README.md

Menu routes for WordPress JSON REST API

WordPress plugin that extends the JSON REST WP API with new routes pointing to WordPress registered menus. Read the WP API documentation.

New routes available:

  • /list list of every registered menu.
  • /<id> data for a specific menu.
  • /locations list of all registered theme locations.
  • /locations/<location> data for menu in specified menu in theme location.

Currently, the 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. The menus/<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 data arrangement of each individual menu items and children using the filter hook json_menus_format_menu_item.

Contributing

  • Submit a pull request or open a ticket here on Github.
You can’t perform that action at this time.