-
Notifications
You must be signed in to change notification settings - Fork 15
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
Can't retrieve Core Navigation data #187
Comments
Hello @studiohic. Thank you for the report. After looking into this, I can see that this block is not a standard block that has queryable attributes. Its part of the Full-stack editing blocks that are generated dynamically per page. If you look at the contents of a saved CoreNavigation block you will see that it contains only a reference:
This means that by default it cannot be parsed using the parse_blocks function. It won't do anything. One could try to fix this by retrieving the navigation model from the ref id (using https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/) and with adding Query Attributes that extract the menu items from the HTML or return the menu node so that users can query it. Here is an example of how we do this with the MediaDetails attribute of the Image block Here is the block code that does this work maybe you can make a sense out of it: |
See: b813352 |
Released in v4.5 |
Thanks for your hardwork on this. I'm struggling to get data from CoreNavigation, CoreNavigationLink, CoreNavigationSubmenu. Please see code:
This returns the following:
The text was updated successfully, but these errors were encountered: