Did you know that Gutenberg Reusable Blocks are stored as a bundled Post Type in WordPress database? Yep they are. You can even access them on the Reusable Blocks hidden admin screen available in example.com/wp-admin/edit.php?post_type=wp_block.
If Reusable Blocks are registered as a post type, then they are queryable as well as any post type in WordPress.
So we could easily get them outside of the editor…
Yeah! Looks great, let’s build some cool stuff!
Introducing get_reusable_block PHP function
This function will only get the formatted HTML content of a given Reusable block ID and return it.
Note: I’m prefixing the function with advent_ for the sake of WordPress Coding Standards 😎