How to add button to Gutenberg Editing Toolbar in Wordress

Here’s how Kadence does it. I’d avoid hacks like that if possible but I’m not sure what your requirements are.

Some alternative ideas (not mutually exclusive):

  • Use plugin sidebar
  • Add a command to do whatever the button would
  • Add a keyboard shortcut to do whatever the button would

On that third item I don’t know of a good documentation example of how to do it but here’s the relevant parts in core of how it’s done for the Keyboard Shortcut Help modal. It’s a two-step of registerShortcut/useShortcut.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)