1. Home
  2. Wordpress
  3. Disable gutenberg editor

Disables Gutenberg editor and brings back the Classic editor. Additional actions remove related styles too.

#wordpress#php
/**
 * Disable Gutenberg on the back end.
 */
add_filter( 'use_block_editor_for_post', '__return_false' );

/**
 * Disable Gutenberg for widgets.
 */
add_filter( 'use_widgets_blog_editor', '__return_false' );

/**
 * Disable Gutenberg styles.
 */
add_action( 'wp_enqueue_scripts', function() {
    // Remove CSS on the front end.
    wp_dequeue_style( 'wp-block-library' );

    // Remove Gutenberg theme.
    wp_dequeue_style( 'wp-block-library-theme' );

    // Remove inline global CSS on the front end.
    wp_dequeue_style( 'global-styles' );
}, 20 );
copy
Full Wordpress cheatsheet