-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gatsby-source-wordpress] Get menu items (wordpressWpApiMenusMenus) #1612
Comments
@sebastienfi any idea? |
@benjamingeorge For some reason the WP-API-Menus Wordpress plugin does not give the menu items on its main API endpoint. Another call is necessary. To cover this use case I updated the We have to wait for this PR to pass, then you'll have to update using You will then have the menus using this GaphQL request. I updated the documentation #1619
In your page Then you could use filter to target the menu of your choice using its name (which may be better than using its ID) : |
It has been merged thanks to @KyleAMathews |
looks like there is an issue in the latest release. When I upgrade I get this error when running a build.
|
That should be fixed now. @KyleAMathews : thinking about having the right to close issues... |
Yes the newest release fixed this issue. Thank you. |
The initial issue is fixed however this only returns the top level items. Wordpress menus can have children of children so it should be recursive. I'm unsure if GraphQL is capable of this. In addition this might be a bigger feature request....let me know if I should create a different issue. |
This isn't working for me on Gatbsy v2.x The query is totally unrecognised by the graphiQL.
Here's the source for reference: https://www.bryceyork.com/wp-json/wp-api-menus/v2/menus/ |
Ended up brute forcing it. I'll be making a PR to update the docs to include some examples for working with WP-API-MENUS.
|
When using this query
I get this result which is correct but it doesn't have the menu "items" array
when going to the self URL ("http://testwordpress.dev/wp-json/wp-api-menus/v2/menus/2") in a browser the JSON does include the items
I tried adding items prop to the query but I get an error. I guess my question is how do you query wordpressWpApiMenusMenus and get the actual menu items ? I'm new to GraphQL so I don't know if i'm missing another step.
The text was updated successfully, but these errors were encountered: