Disable Gutenberg Editor (use Classic Editor) in WordPress

01/30/2024
Back to Gists
<?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);