Reusable blocks in WordPress Gutenberg are an amazing feature that has greatly improved the maintainability of code on websites. I use them all the time for block scripts, special CSS instructions, and even for some repeatable patterns. The WordPress pattern directory is still a work in progress, and you can’t create your own patterns without writing special code. That’s not sustainable in the long run.
Unfortunately, reusable blocks are very easy to accidentally modify. Particularly when there are multiple blocks grouped, it can get hard to select the block as a whole instead of one of the individual elements within. For example, take this reusable block I created as a test:
In this group, I have two paragraph blocks, and one image block with a caption underneath. Now let’s say I want to add a block above it, so I click on the reusable block, and press “Ctrl+T” to insert a new block above. Unfortunately, because they occupy the same space, I’ve ended up selecting the first paragraph instead of the block itself. This “edits” the reusable block, and gives an error message like this when I try and save the post:
The post is asking me if I want to save not just the content, but the contents of the reusable block itself. The worst part is that you might not even realize that you’ve modified your reusable block. If you careless click “Update” or “Save”, the modified block will change on all the previous posts and pages in which you’ve used it. It can have massive consequences to your site if it’s a commonly used block.
So what’s the solution?
The Lock Reusable Blocks Plugin
This morning, I came across this useful plugin that locks reusable blocks and prevents you from editing them by accident. Most of the time, this is what you want. You can download and install the Lock Reusable Blocks WordPress plugin. Once activated, you don’t need to do anything. The next time you use a reusable block in your post, you’ll see the following when you click on it:
The entire block has been locked, and you can’t edit it by mistake.
Using Reusable Blocks as Patterns
I often use reusable blocks to recreate patterns on my site that I can fill with my content, depending on the situation. The problem is that you first need to “convert” the reusable group into “regular” blocks. If you omit this step and accidentally save your changes, they’ll be propagated throughout your site. Hopefully, you’ll realize your mistake in time.
The Lock Reusable Blocks plugin adds another button next to the “Edit” option that lets you convert reusable blocks to regular ones. Once you do this, you no longer have to worry about messing things up, and you can safely make the changes you want.
It’s a little thing, but makes such a difference! I feel that WordPress should make this functionality available as a default option. Most people who use reusable blocks don’t want to immediately make changes to them, and if they do, it’s probably because they forgot to convert them into regular blocks. I see no downside to making this happen.
Perfect for Multiple Editors
Of course, you can’t install every single plugin that catches your fancy. I can’t even say for sure that I’ll use it on my own site – WP-Tweaks.com. However, if you have multiple writers, and you want to make sure that none of them accidentally screw things up, this plugin is indispensable. You can’t take the risk that one of your writers will mistakenly edit a reusable block with site-wide consequences. So for that use case scenario, it’s perfect!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!