Closed sangrepura closed 8 months ago
Note: Here;s teh query in the IDE:
{
menus(where: {location: PRIMARY}) {
nodes {
name
menuItems {
nodes {
uri
url
order
label
}
}
}
}
generalSettings {
title
url
description
}
}
And the result:
{
"data": {
"menus": {
"nodes": [
{
"name": "Default",
"menuItems": {
"nodes": [
{
"uri": "/my-account/",
"url": "REDACTED/my-account/",
"order": 1,
"label": "My account"
},
....REDACTED
}
}
}
}
OK, I found the issue! The field "RootQuery.menus" cannot be accessed without authentication see: https://www.wpgraphql.com/docs/menus#access-control
Just add an Application password and set it in your headers:
headers: {
'Content-Type':'application/json',
Authorization: `Basic ${hashedCredentials()}`
},
I'm opening a new issue because I'm encountering the same issue as https://github.com/JEverhart383/astro-wordpress-starter/issues/11
I tried with the "Twenty Twenty-Three "and "Twenty Twenty-Four" WP themes with and without Faust installed
I also ensured that the menu items were added to PRIMARY and the GraphQL query words fine in the IDE
Using the default query in this code base:
Any help would be appreciated!