Skip to content

Instantly share code, notes, and snippets.

@nathan-roberts
Created July 28, 2022 08:45
Show Gist options
  • Select an option

  • Save nathan-roberts/e19e5a6207ec507830adf8d768d89477 to your computer and use it in GitHub Desktop.

Select an option

Save nathan-roberts/e19e5a6207ec507830adf8d768d89477 to your computer and use it in GitHub Desktop.

Revisions

  1. nathan-roberts created this gist Jul 28, 2022.
    12 changes: 12 additions & 0 deletions gutenberg-disable-fullscreen.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php
    /**
    * Disable Fullscreen Gutenberg.
    */
    if (is_admin()) {
    function ca_disable_editor_fullscreen_by_default()
    {
    $script = "jQuery( window ).load(function() { const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); if ( isFullscreenMode ) { wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); } });";
    wp_add_inline_script('wp-blocks', $script);
    }
    add_action('enqueue_block_editor_assets', 'ca_disable_editor_fullscreen_by_default');
    }