Last active
July 26, 2022 10:00
-
-
Save Yorlinq/2cd376fda152835d6a4ff1f2438ed820 to your computer and use it in GitHub Desktop.
Deactivate Gutenberg editor including all unnecessary files - WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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