Linux 软件免费装
Banner图

WP API Menus

开发者 nekojira
austyfrosty
更新时间 2020年8月18日 15:21
捐献地址: 去捐款
PHP版本: 3.6.0 及以上
WordPress版本: 5.5.0
版权: GPLv2 or later
版权网址: 版权信息

标签

menus json api rest wp-api wp-rest-api json-rest-api menu-routes

下载

1.1.4 1.1.5 1.2.0 1.2.1 1.3.0 1.3.2 1.1.1 1.1.2 1.1.3

详情介绍:

This plugin extends the WordPress JSON REST API with new routes for WordPress registered menus The new routes available will be: Currently, the menu-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. An important note on WP API V2: In V1 the routes are located by default at wp-json/menus/ etc. In V2 the routes by default are at wp-json/wp-api-menus/v2/ (e.g. wp-json/wp-api-menus/v2/menus/, etc.) since V2 encourages prefixing and version namespacing.

安装:

This plugin requires having WP API installed and activated or it won't be of any use. Install the plugin as you would with any WordPress plugin in your wp-content/plugins/ directory or equivalent. Once installed, activate WP API Menus from WordPress plugins dashboard page and you're ready to go, WP API will respond to new routes and endpoints to your registered menus.

升级注意事项:

1.2.1 API V2 only: mind lowercase id instead of uppercase ID in API responses, to match the standard for id used across WP REST API.

常见问题:

Is this an official extension of WP API?

There's no such thing.

Will this plugin do 'X' ?

You can submit a pull request to: https://github.com/unfulvio/wp-api-menus However, menu data organization in json is a bit arbitrary and subjective, and that's why probably hasn't made it into WP API by the time of writing. You could also fork this plugin altogether and write your json output for a specific use case.

更新日志:

1.3.2 1.3.1 1.3.0 1.2.1 1.2.0 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.0