Open studiohic opened 9 months ago
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:
<!-- wp:navigation {"ref":45} /-->
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:
Thanks for your hardwork on this. I'm struggling to get data from CoreNavigation, CoreNavigationLink, CoreNavigationSubmenu. Please see code:
This returns the following: