Skip to content

Instantly share code, notes, and snippets.

@knolaust
Last active January 30, 2024 14:49
Show Gist options
  • Save knolaust/faf57dba14c9ff655e60b2741d9d3821 to your computer and use it in GitHub Desktop.
Save knolaust/faf57dba14c9ff655e60b2741d9d3821 to your computer and use it in GitHub Desktop.
Disable Gutenberg Editor (use Classic Editor) in WordPress
<?php
/**
* Disables the Gutenberg editor for editing posts.
*
* This snippet attaches to both 'gutenberg_can_edit_post' and
* 'use_block_editor_for_post' hooks to disable the Gutenberg editor,
* reverting to the classic WordPress editor. The priority is set to 5
* to ensure this runs early enough to override any default settings.
*
* Gist Keywords: wordpress, editor, gutenberg, classic
*
* @link https://developer.wordpress.org/reference/hooks/gutenberg_can_edit_post/ WordPress Hook: gutenberg_can_edit_post
* @link https://developer.wordpress.org/reference/hooks/use_block_editor_for_post/ WordPress Hook: use_block_editor_for_post
*
* @author Knol Aust
*/
add_filter('gutenberg_can_edit_post', '__return_false', 5);
add_filter('use_block_editor_for_post', '__return_false', 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment