`/wp/v2/menus`

Namespace: wp/v2
Route: /wp/v2/menus

Routes

  • Collection: /wp/v2/menus
  • Single: /wp/v2/menus/{id}

HTTP Methods

Collection methods: GET, POST

Single methods: GET, POST, PUT, PATCH, DELETE

Request Parameters

Collection GET

ParameterTypeRequiredDefaultDescription
contextstringfalseviewScope under which the request is made; determines fields present in response.
pageintegerfalse1Current page of the collection.
per_pageintegerfalse10Maximum number of items to be returned in result set.
searchstringfalseLimit results to those matching a string.
excludearrayfalse[]Ensure result set excludes specific IDs.
includearrayfalse[]Limit result set to specific IDs.
offsetintegerfalseOffset the result set by a specific number of items.
orderstringfalseascOrder sort attribute ascending or descending.
orderbystringfalsenameSort collection by term attribute.
hide_emptybooleanfalseFalseWhether to hide terms not assigned to any posts.
postintegerfalseNoneLimit result set to terms assigned to a specific post.
slugarrayfalseLimit result set to terms with one or more specific slugs.

Collection POST

ParameterTypeRequiredDefaultDescription
descriptionstringfalseHTML description of the term.
namestringtrueHTML title for the term.
slugstringfalseAn alphanumeric identifier for the term unique to its type.
metaobjectfalseMeta fields.
locationsarrayfalseThe locations assigned to the menu.
auto_addbooleanfalseWhether to automatically add top level pages to this menu.

Single GET

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the term.
contextstringfalseviewScope under which the request is made; determines fields present in response.

Single POST, PUT, PATCH

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the term.
descriptionstringfalseHTML description of the term.
namestringfalseHTML title for the term.
slugstringfalseAn alphanumeric identifier for the term unique to its type.
metaobjectfalseMeta fields.
locationsarrayfalseThe locations assigned to the menu.
auto_addbooleanfalseWhether to automatically add top level pages to this menu.

Single DELETE

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the term.
forcebooleanfalseFalseRequired to be true, as terms do not support trashing.

Response Schema (Item)

FieldTypeDescription
idintegerUnique identifier for the term. (read-only)
descriptionstringHTML description of the term.
namestringHTML title for the term.
slugstringAn alphanumeric identifier for the term unique to its type.
metaobjectMeta fields.
locationsarrayThe locations assigned to the menu.
auto_addbooleanWhether to automatically add top level pages to this menu.

Authentication

  • Read/Write: edit_theme_options.

Example Requests

bash
curl -X GET "https://wordpress.org/news/wp-json/wp/v2/menus"
bash
curl -X POST "https://wordpress.org/news/wp-json/wp/v2/menus" 
  -H 'Authorization: Basic <app-password>' 
  -H 'Content-Type: application/json' 
  -d '{"title":"Example"}'
bash
curl -X GET "https://wordpress.org/news/wp-json/wp/v2/menus/1"

Example Response (trimmed)

json
{
  "id": 1,
  "_links": {
    "self": [{ "href": "/wp/v2/menus/1" }]
  }
}