-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
wp.data.select() is not working on the Experimental Navigation page #22022
Comments
Screencast: |
It looks like there's two separate issues here:
|
I wonder if this is because those selectors can only run within the scope of the |
No, that's because by |
#23033 solved this issue. It is now possible to use the following selectors: wp.data.select( 'core/edit-navigation' ).getNavigationPostForMenu( menuId );
wp.data.select( 'core/edit-navigation' ).getMenuItemForClientId( clientId ); |
#23675 will solve this problem - I encourage reviews and discussion. |
This issue is now solved in full. Feel free to reopen if anything comes up. |
Describe the bug
I am attempting to retrieve the menu item ID (the underlying post ID) of the selected menu item.
On the Experimental Navigation page, I believe the menu item ID will be stored as the clientId on the block.I am using the following to get the clientId:
wp.data.select( 'core/block-editor' ).getSelectedBlock().clientId;
On a standard post or page
This works, the client ID is returned as expected:
On the Experimental Navigation page
This doesn't work, the same code returns an error:
To reproduce
wp.data.select( 'core/block-editor' ).getSelectedBlock().clientId;
Expected behavior
The client ID of the selected block is returned.
Editor version:
The text was updated successfully, but these errors were encountered: