Skip to content

Remove the metabox resize handle in some WordPress installation

Why is it in some instances visible and in others not?

Gutenberg editor can run at the moment in two modes: Iframed and non-iframed. Iframed mode is the preferred one by the system as it offers many benefits for the styling consistency etc. But Iframed mode can only work with newer blocks. So as long as you install any plugins that contain Gutenberg blocks with the API version v2, the editor will switch to non-iframe mode.

How to fix it?

Just drop this in the functions.php and create a dummy API v2 block to disable the Gutenberg iframe mode.

add_action('enqueue_block_editor_assets', function() {
    wp_add_inline_script(
        'wp-blocks',
        "
        wp.domReady(function() {
            wp.blocks.registerBlockType('custom/force-api-v2', {
                apiVersion: 2,
                title: 'Invisible',
                category: 'widgets',
                supports: {
                    inserter: false
                },
                edit: function() {
                    return null;
                },
                save: function() {
                    return null;
                }
            });
        });
        "
    );
});

Via

An den Anfang scrollen