本文档介绍了 WordPress REST API 中菜单位置(Menu Locations)的架构和端点,包括字段定义和检索方法。面向开发者,用于通过 API 管理菜单位置数据。
$ curl https://example.com/wp-json/wp/v2/menu-locations$ curl https://example.com/wp-json/wp/v2/menu-locations/<location> The schema defines all the fields that exist within a menu location record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.
name
|
The name of the menu location.
JSON data type: string Read only Context: |
description
|
The description of the menu location.
JSON data type: string Read only Context: |
menu
|
The ID of the assigned menu.
JSON data type: integer Read only Context: |
GET /wp/v2/menu-locations
Query this endpoint to retrieve a specific menu location record.
$ curl https://example.com/wp-json/wp/v2/menu-locations
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |
GET /wp/v2/menu-locations/<location>
Query this endpoint to retrieve a specific menu location record.
$ curl https://example.com/wp-json/wp/v2/menu-locations/<location>
location
|
An alphanumeric identifier for the menu location. |
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |