Experimenting With Reusable Blocks to Create Post Templates

For the past several years, I’ve used the Post Template plugin developed by Vincent Prat to create and manage post templates. For example, some of the information in the WordPress Weekly and In Case You Missed It posts never changes and instead of manually entering it each time, it’s nice to use a template where only a few changes are necessary.

The other day, I was wondering if I could use the reusable block feature in Gutenberg to replace the plugin. Justin Tadlock reached out and provided me a reusable block template JSON file that I imported into Gutenberg. By the way, if you successfully import a block into WordPress, the block won’t appear until you manually refresh the page.

The reusable block template approach works fairly well. However, I noticed that I was unable to add a block inside the reusable block. When I tried, a red line was displayed and any blocks that were inserted were removed.

Red Means No

I understand that reusable blocks are meant to be restricted templates where changes are distributed across a site to wherever the block is displayed. But it’s still a bummer that I can’t add a block inside the template for a singular purpose if a need arises.

One other thing I noticed is that reusable blocks are custom post types. While there is a link to manage them within the reusable block selector, there isn’t a dedicated item within the admin menu. Unless you know the location of the management link, adding and managing them can be a bit more time-consuming.

If you want a quick shortcut to the reusable block management screen, add this to the URL after your domain name. wp-admin/edit.php?post_type=wp_block

I think I’ll experiment with reusable blocks a bit more but as long as they’re not changing often, I believe they’ll make a nice replacement for the Post Templates plugin. What use cases have you encountered where reusable blocks were the solution?

Would you like to write for WP Tavern? We are always accepting guest posts from the community and are looking for new contributors. Get in touch with us and let's discuss your ideas.

Exactly – you have to convert it to a regular block ! Also, even though Reusable Blocks are CPTs as you mentioned they are not available for exporting from the tools menu. You can only export one Reusable Block at a time, which is pain if you have dozens of them. The mass export functionality was there with the Gutenberg Plugin used with WP 4.9x. When WP 5.0 came around, this disappeared. I reported the issue on Slack and whoever responded, were surprise that exporting from the tools menu is not available. That was in December, here we are 6 months later, and nothing is done…

It’s ok though, someone created the plugin “fabrica-reusable-block-instances” which not only gives you the option to export all Reusable Blocks at once, but also, it shows you where each Reusable Block is been used, which is very useful, especially when you are deleting those blocks…

Anyone suggesting to include these 2 functionalities to the core will be total waste of time and frustration…

Yes, a reusable block is like global block with specific configuration. When we need to change it for a specific post, we need to duplicate it and change the configuration. In Gutenberg, duplication a reusable block means converting it to a normal block.

“While there is a link to manage them within the reusable block selector, there isn’t a dedicated item within the admin menu. Unless you know the location of the management link, adding and managing them can be a bit more time-consuming.”
You also have it in the main menu: https://imgur.com/a/BF8i4oh

“I noticed that I was unable to add a block inside the reusable block, it’s still a bummer that I can’t add a block inside the template for a singular purpose if a need arises”
You can, converting it to a regular block. That’s logical and easy for me. Screenshot: https://imgur.com/a/REqKvf4