I use this shortcode very often: [foo]123[/foo].
I'd like to drag and drop a custom block in the block editor, instead of typing the shortcode (and making typos).
So how do I create a custom block, that just wraps that shortcode?
Thanks
There is a way to do this via code: use the do_shortcode('[your-shortcode-name-here]') function. It's drop-dead simple. The doc is at https://developer.wordpress.org/reference/functions/do_shortcode/.
You can use a filter hook with the do_shortcode() function to make pretty much anything in WordPress shortcode-capable. For example, to enable shortcodes in the post titles, do this: add_filter('the_title', 'do_shortcode')