Development WordPress

Disable Block Editor default FullScreen mode in WordPress 5.4

Scheduled for March 31, 2020, WordPress 5.4 will enable FullScreen mode by default in the Block Editor / Gutenberg.

Even if I’m fully involved in WordPress version 5.4 –as a member of the release squad– I have to admit I’m not super comfortable with the editor in fullscreen mode by default. Indeed, I prefer to always keep a direct access to WP-Admin main menu.

To keep fullscreen mode disabled by default, the following snippet can be used in your (child) theme’s functions.php file:

function jba_disable_editor_fullscreen_by_default() {
	$script = "window.onload = function() { const isFullscreenMode = 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); if ( isFullscreenMode ) { 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); } }";
	wp_add_inline_script( 'wp-blocks', $script );
add_action( 'enqueue_block_editor_assets', 'jba_disable_editor_fullscreen_by_default' );

That’s all! 😎

Worth noting you can add this snippet in your code now. It won’t break your website and it will prevent switching to fullscreen once your website is updated to WP 5.4.

You can also use my micro-plugin (clic on the ZIP download link) to automatically disable default full screen mode.

For reference, see this change’s announcement on the related dev note on Make/Core:

12 replies on “Disable Block Editor default FullScreen mode in WordPress 5.4”

Hi and thank you for this!
One question if you don’t mind..

Is there a way to change the W (WordPress) icon in the top left if NOT using your snippet? If so, how?

Again, thank you.

Thank you for this script,
but unfortunately this is not working for me…
If i delete the cache of my browser, the fullscreen-mode will be enabled again.

I’m getting the following error: Uncaught ReferenceError: jQuery is not defined.

I believe its because this script is loaded before jquery in the backend.

Do you have a solution for this problem?

Thanks for the code, it’s gone straight into my base theme. However I find the fact this snippet has to exist, plus the hacky method of adding some inline JS, incredible. This setting should, without doubt, be stored as user meta.

Rather than put in the functions.php file, wouldn’t it be better to make it a stand alone custom plugin?

That would make the code “theme agnostic”?

Thank you for this really helpful snippet!
But it seems that it won’t work with WordPress 5.5 anymore :/
Can anyone confirm this?

Are there any ideas how to fix it?

Is it possible to disable the editor completely on the pages and posts edit screens? I use Oxygen Builder so the built-in editor is never used.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Legal notice