-
-
Save Lovor01/18227f4384a6d6b78802355f838d9ec7 to your computer and use it in GitHub Desktop.
Block editor (Gutenberg) Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get current post categories | |
wp.data.select('core/editor').getEditedPostAttribute('categories') | |
wp.data.select('core/editor').getCurrentPostAttribute('categories') | |
// Get the data of a block | |
wp.data.select( 'core/editor' ).getBlocks()[0] | |
// Update attributes of another block | |
// wp.data.dispatch( 'core/editor' ).updateBlockAttributes( clientID, attributes ) | |
wp.data.dispatch( 'core/editor' ).updateBlockAttributes( '10d88a6d-95d6-4e07-8293-5f59c83a26c0', { heading: 'New Heading' } ) | |
// Get currently selected block. | |
wp.data.select( 'core/editor' ).getBlockSelectionStart() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment