Вопрос

I am trying to access wordpress menus using the /wp/v2 api.

The endpoint that I am using is:

My wordpress Staging Site's WP-API Endpoint

The Plugin I am using is:

https://wordpress.org/plugins/wp-api-menus/#description

But on accessing menus I am getting this error message for permission denied:

Error is:

{
"code": "rest_cannot_view",
"message": "Sorry, you cannot view these menus, unless you have access to permission edit them. ",
"data": {
"status": 401
}
}

How can i Set public if it is possible?

Это было полезно?

Решение

You didn't change your prefix for that plugin's API.

Instead of

/MC-ACF/wp-json/wp/v2/menus

try

/MC-ACF/wp-json/wp-api-menus/v2/menus

That plugin developer states it right on the page you referenced in your question. If you're wondering how I solved this.

I'm not sure what your use case is, but there are newer versions of similar plugins as well. That one works fine, but has not been updated in some time.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с wordpress.stackexchange
scroll top