Support » Plugin: Reusable Blocks Extended » Suggestion: prevent reusable blocks from being edited in the editor

  • Just an idea. (Not really necessary because it might make your plugin too complex.)

    This plugin is making reusable blocks so much more useful and intuitive! However, something I missed (and had to code myself), is the possibility to prevent reusable blocks from being editable inside the post context, but instead only allow changing of reusable blocks trough the blocks menu.

    I have written a bit of hacky jQuery code to make this possible, it might save you some digging trough the API if you would be interested in implementing this option. The snippet can be pasted straight in the functions.php file and it should work of the box, if you’d like to test it out.

    add_action('admin_head', function () {
                .block-library-block__reusable-block-container {
                    pointer-events: none;
                    background: #ffb3b3;
                    position: relative;
                    $(window).load( function() {
                        $('.edit-post-visual-editor').on('click',function(e) {
                            $block = $(;
                            if ($block.hasClass('is-reusable')) {
                                if (confirm('You are about to convert this reusable block to regular blocks. Are you sure you want to do this?')) {
                                    const clientId = $block.attr('data-block');

    To get an idea about whether or not people actually care about this, here’s a topic that mentions this, with quite a lot of github-issues and pull requests added by @paaljoachim

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.