Skip to content

Instantly share code, notes, and snippets.

@Yorlinq
Last active July 26, 2022 10:00
Show Gist options
  • Save Yorlinq/2cd376fda152835d6a4ff1f2438ed820 to your computer and use it in GitHub Desktop.
Save Yorlinq/2cd376fda152835d6a4ff1f2438ed820 to your computer and use it in GitHub Desktop.
Deactivate Gutenberg editor including all unnecessary files - WordPress
// Deregister block styles
function yl_deregister_gutenberg_block_styles() {
wp_dequeue_style('wp-block-library');
wp_deregister_style('wp-block-library');
}
add_filter('use_block_editor_for_post', '__return_false', 10);
add_filter('use_block_editor_for_post_type', '__return_false', 10);
add_action('wp_print_styles', 'yl_deregister_gutenberg_block_styles', 100);
// Remove Gutenberg CSS
function yl_remove_gutenberg_assets() {
wp_dequeue_style('wp-block-library');
}
add_action('wp_enqueue_scripts', 'yl_remove_gutenberg_assets', 100);
// Disables the block editor from managing widgets in the Gutenberg plugin
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
// Disables the block editor from managing widgets
add_filter('use_widgets_block_editor', '__return_false');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment