Over the weekend, web developer Marie Comet released the Lock Reusable Blocks plugin. Since then, she has published a couple of more updates that polish that initial release. The extension blocks users from directly editing reusable blocks from the post-editing screen.
Reusable blocks allow users to group one or more blocks in the post editor, save them, and reuse anywhere blocks are supported. Technically, they are “shared” or “synced.” If editing a reusable block in one location, all uses of it will share those changes.
The problem with the feature is that it is not always clear when you are editing a reusable block. WordPress will display its name in the toolbar, list view, and breadcrumbs nav. However, the only clear message that it is a shared instance is in the sidebar panel, which only appears if open.
Before WordPress 5.7, users had to click an “Edit” button to make changes to a reusable block. At least in that scenario, it was somewhat clear that the content was different from the main post or page content. However, 5.7 rolled out a “click-through” method for editing. The first click selects the wrapper element around the saved block, requiring a second click to edit any inner content. This change has made it far too easy to inadvertently edit global content.
I am familiar enough with the editor that I doubt I would slip up with this problem. However, I still hand sites over to friends and family from time to time. Most never discover the feature, but those who do inevitably make these global changes when they did not intend to. I have also heard enough client-related horror stories from others to know it is a legitimate issue.
There is an open ticket to bring a locking mechanism to reusable blocks, and there has been a patch for it since June 2021. However, there has not been much movement in the last several months. In the meantime, at least we have the Lock Reusable Blocks plugin.
Comet’s solution takes a different approach from earlier versions of WordPress and the proposed patch. Instead of giving users the option to edit in-content, they are blocked from doing so altogether:
The plugin grays out the reusable block and adds two buttons over the top when selected in the editor. The first button enables editing, but it does so by opening a new browser tab/window and taking the user to the editor for the block itself. This approach makes it clear that the content is separate from the post.
WordPress’s reusable block management screen is hidden by default, but there are a few plugins that enable it.
The plugin’s second button in the overlay allows users to convert the reusable block to regular blocks. Doing this takes it out of the global scope and can be safely edited without affecting other uses.
I want to like the reusable blocks feature in WordPress. I understand how it could be one of the platform’s most powerful tools. However, its implementation has yet to live up to the potential it showed four years ago when under development in Gutenberg.
If we could fix the accidental-editing issue and the longstanding problem with wide alignments not working (I could not write this post without at least noting that ticket), it could start down the path of becoming the feature it was always meant to be.