WordPress at a glance

How to revert to ‘old’ editor in WordPress (disable Gutenberg with code or plugin)

In WordPress 5.0 new content editor Gutenberg was added into the core. It completely changed post editing admin-page and the way the content was written. On some sites, such drastic changes can break the current functionality, so there this editor will need to be disabled. In this short article, I show you how to return the old WordPress editor by using code or by installing a plugin.

Disable Gutenberg with Code (hard disabling)

The hook use_block_editor_for_post_type allows disable block editor (Gutenberg).

Paste the following code into the functions.php theme file or anywhere else:

## Disables Gutenberg (new block editor in WordPress).
## ver: 1.0
if( 'disable_gutenberg' ){
	add_filter( 'use_block_editor_for_post_type', '__return_false', 100 );

	// Move the Privacy Policy help notice back under the title field.
	add_action( 'admin_init', function(){
		remove_action( 'admin_notices', [ 'WP_Privacy_Policy_Content', 'notice' ] );
		add_action( 'edit_form_after_title', [ 'WP_Privacy_Policy_Content', 'notice' ] );
	} );
}

Disable Gutenberg with plugin (soft disabling)

Classic Editor plugin disables Gutenberg block editor.

If you want to leave Gutenberg on site (to be able to edit some articles in the new editor, and others in the classic one), then hard disabling using code variant is not an option. In this case, it is better to install the plugin "Classic Editor".

After installing and activating the plugin, you need to go to the settings page: Settings > Writing and choose which of editors will be used by default, as well as give/deny the ability to select the editor to users.

If we leave the editors choosable, we will see the following links in the posts list table:

Briefly about the possibilities of the plugin:

  • Administrators can select the default editor for all users.
  • Administrators can allow users to change their default editor.
  • When allowed, the users can choose which editor to use for each post.
  • Each post opens in the last editor used regardless of who edited it last. This is important for maintaining a consistent experience when editing content.

The principle of the plugin is based on the hook use_block_editor_for_post_type.

No comments
    Hello, !     Log In . Register