Add this PHP snippet to your functions.php file and stop banging your head every time you edit a post.

WordPress’ Gutenberg editor has come a long way and we’re still adjusting getting to some of its features, but for the most part I think the shift in the editorial process has been for the good. That said, I have not been able to get on board with the new “Fullscreen mode” that the edit screen defaults to. The minimal gain in screen space doesn’t make up for the drastic change in admin interface and loss of basic admin navigation.

Luckily, there’s a quick fix for this. Simply add the following snippet to your functions.php file and editing posts will no longer default to fullscreen mode:

/* Disable Fullscreen Mode */
function wpfox_disable_editor_fullscreen_mode() {
	$script = "window.onload = 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', 'wpfox_disable_editor_fullscreen_mode' );

And don’t worry, this doesn’t remove fullscreen mode completely. You can still flip it on if that’s your, or your clients’, cup of coffee. But at least it doesn’t default to it anymore! 🥳

Allen Robinson

Director of Application Development
Allen has been responsible for overseeing client website development, implementation, and maintenance at Foxtrot Media for over 10 years. A Computer Science graduate from the University of Wisconsin- Madison, Robinson is a software development and content management system specialist, fluent in CSS, PHP, MySQL, HTML, and JavaScript.

Comments

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.

Allen Robinson

Director of Application Development
Allen has been responsible for overseeing client website development, implementation, and maintenance at Foxtrot Media for over 10 years. A Computer Science graduate from the University of Wisconsin- Madison, Robinson is a software development and content management system specialist, fluent in CSS, PHP, MySQL, HTML, and JavaScript.

Post Details

Software/Plugins:

Languages:

Related Articles