See Registered Keyboard Shortcuts in WordPress Block Editor

To see the registered keyboard shortcuts in the WordPress block editor, we can query the keyboard shortcuts data store directly. Official documentation for the keyboard shortcuts store can be found here.

Get Shortcuts by Category

First we can retrieve a list of all keyboard shortcuts registered to a specific category. Using the ‘global’ category as an example, our query uses getCategoryShortcuts, and looks like this:

wp.data.select('core/keyboard-shortcuts').getCategoryShortcuts('global');

Running this command from the Chrome devtools console in the WordPress editor will generate output similar to the following:

See Individual Shortcut Codes

To see the keyboard command associated with a specific shortcut, we can query the data store with getAllShortcutKeyCombinations. Using the ‘undo’ command as our example, the query looks like this:

wp.data.select('core/keyboard-shortcuts').getAllShortcutKeyCombinations('core/editor/undo');

Running this command in the devtools console will reveal the keyboard combination associated with the given keyboard shortcut.

In this case we see the key combination for ‘Undo’ is ‘z’ + ‘primary’, where ‘primary’ is the ‘command’ key (Mac) or ‘alt’ key (Windows).

the author profile picture

Ryan Neilson is a software developer from Nova Scotia, Canada, where he lives with his wife and their menagerie of pets. He has worked extensively with PHP, WordPress, JavaScript, React, SCSS and CSS. Ryan can be found professionally at News Corp, where he works as a lead software engineer.