46

How to Disable the WordPress Fullscreen Editor by Default

Powered by WPCodeBox

Optimize your WordPress workflow by disabling the default fullscreen editor. This snippet removes the full screen mode, allowing you to access the familiar admin toolbar and WordPress menu when editing pages or posts.


<?php 

if (is_admin()) { 
	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 );
	}
	add_action( 'enqueue_block_editor_assets', 'jba_disable_editor_fullscreen_by_default' );
}

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.