Last active
March 28, 2020 03:51
-
-
Save blogjunkie/188774f10e135be6776c61d036a5612d to your computer and use it in GitHub Desktop.
Disable Block Editor default FullScreen mode in WordPress 5.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't copy this line -- paste the code below into your theme's functions.php file | |
add_action( 'enqueue_block_editor_assets', 'jba_disable_editor_fullscreen_by_default' ); | |
/** | |
* Disable Block Editor default FullScreen mode in WordPress 5.4 | |
* | |
* @author @audrasjb | |
* @link https://jeanbaptisteaudras.com/en/2020/03/disable-block-editor-default-fullscreen-mode-in-wordpress-5-4/ | |
*/ | |
function jba_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 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment