Skip to content

Instantly share code, notes, and snippets.

@jonschr
Created October 18, 2023 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschr/ebcb436f747852a0061a8d8e2df4f99e to your computer and use it in GitHub Desktop.
Save jonschr/ebcb436f747852a0061a8d8e2df4f99e to your computer and use it in GitHub Desktop.
//* Disable fullscreen mode
add_action( 'enqueue_block_editor_assets', 'elodin_disable_fullscreen_mode' );
function elodin_disable_fullscreen_mode() {
if ( !is_admin() )
return;
$script = "
jQuery( window ).load(function() {
// disable fullscreenmode
const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' );
if ( isFullscreenMode ) {
wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' );
}
// disable publish check
wp.data.dispatch('core/editor').disablePublishSidebar();
});
";
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