Disable Gutenberg editor
To disable Gutenberg, add the following code to your functions.php file:
// Disable Gutenberg editor for all post types
add_filter('use_block_editor_for_post_type', 'disable_gutenberg_for_all_post_types', 10, 2);
function disable_gutenberg_for_all_post_types($use_block_editor, $post_type) {
return false;
}
Disable Gutenberg’s default styles
If you also want to disable Gutenberg’s default styles, add the following code to your functions.php file:
// Remove Gutenberg-related styles from frontend
function remove_gutenberg_styles_from_frontend() {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
wp_dequeue_style('wc-block-style');
}
add_action('wp_enqueue_scripts', 'remove_gutenberg_styles_from_frontend', 100);