0
0
WordpressHow-ToBeginner · 3 min read

How to Disable Gutenberg in WordPress Quickly and Safely

To disable the Gutenberg editor in WordPress, add the filter add_filter('use_block_editor_for_post', '__return_false'); to your theme's functions.php file or use the Classic Editor plugin. This will revert the editor to the classic one and disable Gutenberg for posts.
📐

Syntax

The main way to disable Gutenberg is by adding a filter in your theme's functions.php file.

  • add_filter('use_block_editor_for_post', '__return_false');: This tells WordPress not to use the block editor for posts.
  • functions.php: The file where you add this code, located in your active theme folder.
php
add_filter('use_block_editor_for_post', '__return_false');
💻

Example

This example shows how to disable Gutenberg by adding a simple line to your theme's functions.php file. After adding this, WordPress will use the classic editor instead of Gutenberg for all posts.

php
<?php
// Disable Gutenberg editor for posts
add_filter('use_block_editor_for_post', '__return_false');
?>
Output
Gutenberg editor is disabled; classic editor loads when editing posts.
⚠️

Common Pitfalls

Common mistakes when disabling Gutenberg include:

  • Adding the code in the wrong file or place, which means it won't run.
  • Not using a child theme, so updates overwrite your changes.
  • Disabling Gutenberg only for posts but forgetting pages or custom post types.
  • Forgetting to clear cache or reload the editor to see changes.

To disable Gutenberg for all post types, you can use a more complete filter.

php
<?php
// Wrong: Adding code outside PHP tags or in unrelated files
// Right: Add inside functions.php with PHP tags

// Disable Gutenberg for all post types
add_filter('use_block_editor_for_post_type', '__return_false');
?>
📊

Quick Reference

MethodCode SnippetEffect
Disable Gutenberg for posts onlyadd_filter('use_block_editor_for_post', '__return_false');Classic editor used for posts
Disable Gutenberg for all post typesadd_filter('use_block_editor_for_post_type', '__return_false');Classic editor used everywhere
Use Classic Editor pluginInstall and activate 'Classic Editor' pluginDisables Gutenberg without code
Disable Gutenberg for specific post typesadd_filter('use_block_editor_for_post_type', function($use_block_editor, $post_type) { return $post_type !== 'your_post_type'; }, 10, 2);Gutenberg disabled only for chosen post types

Key Takeaways

Add the filter 'use_block_editor_for_post' with '__return_false' in functions.php to disable Gutenberg for posts.
Use the Classic Editor plugin for an easy no-code way to disable Gutenberg.
For disabling Gutenberg on all post types, use 'use_block_editor_for_post_type' filter.
Always add code in a child theme's functions.php to avoid losing changes on updates.
Clear cache and reload editor after disabling Gutenberg to see the effect.