Title: Disable Gutenberg via Code + Plugin
Last modified: August 14, 2018

---

# Disable Gutenberg via Code + Plugin

 *  Resolved [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/)
 * Thank you very much for this plugin Jeff, its much appreciated. I have installed
   your plugin on all my sites, and have also added the following code to functions.
   php.
 * add_filter(‘gutenberg_can_edit_post_type’, ‘__return_false’);
 * I did this as a backup in the event that the plugin is accidentally disabled.
   Do you seen any issues with this?
 * Kind regards.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10590415)
 * Hi kmbee,
 * I am glad to help, but not sure if that one line is enough to disable Gutenberg.
   I definitely would test before going live.
 * Cheers.
 *  Thread Starter [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10590863)
 * Oh okay, I found that code on an article you posted on [https://digwp.com/2018/04/how-to-disable-gutenberg/](https://digwp.com/2018/04/how-to-disable-gutenberg/).
 * “To completely disable Gutenberg (aka G7G), add the following line via functions.
   php or custom plugin (or even a must-use plugin!):
 * add_filter(‘gutenberg_can_edit_post_type’, ‘__return_false’);
 * That’s the recommended way of disabling Gutenberg. It simply returns a value 
   of false to Gutenberg’s gutenberg_can_edit_post_type filter, which then disables
   G7G for all post types (i.e., completely). To disable only on specific post types,
   check out the next technique.”
 * I will test. Thank you.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10590938)
 * Well then there you go! Lol, I should not have been so lazy and checked it for
   myself. Anyway, If you’ve got both the code and that line in functions.php, you
   should be good to go for disabling Gutenberg.
    -  This reply was modified 7 years, 9 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
 *  Thread Starter [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10591566)
 * Hehe no worries Jeff, thanks for the confirmation!
 *  Thread Starter [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10865334)
 * Hi Jeff, I see that there is updated code to completely disable Gutenberg in 
   functions.php. I found the code at [https://digwp.com/2018/04/how-to-disable-gutenberg/](https://digwp.com/2018/04/how-to-disable-gutenberg/)
 * I have now included the new code, but also left the old code in place. Do you
   see any potential problems with this? The following is how I have it in functions.
   php
 * // Disable Gutenberg – Newer
    add_filter(‘use_block_editor_for_post’, ‘__return_false’);
 * // Disable Gutenberg – Older
    add_filter(‘gutenberg_can_edit_post_type’, ‘__return_false’);
 * I also have the Disable Gutenberg plugin installed. Will the code in functions.
   php interfere with the plugin at all?
 * Thank you again Jeff
    -  This reply was modified 7 years, 6 months ago by [kmbee](https://wordpress.org/support/users/kmbee/).
    -  This reply was modified 7 years, 6 months ago by [kmbee](https://wordpress.org/support/users/kmbee/).
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10865373)
 * Hi kmbee,
 * If you are using Disable Gutenberg plugin, you don’t need to add any manual code.
   The plugin takes care of everything for you.
 * But if you just want to know about the code FWIW, what you have is the right 
   idea, but may want to add some conditional logic to keep things clean, for example:
 *     ```
       // Disable Gutenberg
       if (version_compare($GLOBALS['wp_version'], '5.0-beta', '>')) {
   
       	// WP > 5 beta
       	add_filter('use_block_editor_for_post_type', '__return_false', 100);
   
       } else {
   
       	// WP < 5 beta
       	add_filter('gutenberg_can_edit_post_type', '__return_false');
   
       }
       ```
   
 * From there you would want to wrap it in a function and hook into plugins_loaded
   or similar. But again, this is just FYI; if you are using the plugin you do not
   need to add any code.
 * I’ll go ahead and update the DigWP article with this conditional snippet 🙂
    -  This reply was modified 7 years, 6 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
      Reason: adds info
    -  This reply was modified 7 years, 6 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
      Reason: adds info
 *  Thread Starter [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10867134)
 * Perfect Jeff, thanks so much. I have the code in functions.php as a backup just
   in case the plugin is disabled.
 *  Thread Starter [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10867500)
 * I see that the version “5.0-beta” is in the code. Do I have to edit the version
   in the code with each WordPress update?
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10867511)
 * Nope. That is the version when Gutenberg was merged into core. No need to edit
   anything.
    -  This reply was modified 7 years, 6 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
 *  Thread Starter [kmbee](https://wordpress.org/support/users/kmbee/)
 * (@kmbee)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10971597)
 * Hi Jeff, I notice that there is a change to the conditional method posted at 
   [https://digwp.com/2018/04/how-to-disable-gutenberg/](https://digwp.com/2018/04/how-to-disable-gutenberg/).
   Do I need to use the updated code?
 * What I have now is;
 * // Disable Gutenberg
    if (version_compare($GLOBALS[‘wp_version’], ‘5.0-beta’,‘
   >’)) {
 *  // WP > 5 beta
    add_filter(‘use_block_editor_for_post_type’, ‘__return_false’,
   100);
 * } else {
 *  // WP < 5 beta
    add_filter(‘gutenberg_can_edit_post_type’, ‘__return_false’);
 * }
 * The update I see is;
 * // Disable Gutenberg
 * if (version_compare($GLOBALS[‘wp_version’], ‘5.0-beta’, ‘>’)) {
 *  // WP > 5 beta
    add_filter(‘use_block_editor_for_post_type’, ‘__return_false’,
   10);
 * } else {
 *  // WP < 5 beta
    add_filter(‘gutenberg_can_edit_post_type’, ‘__return_false’,
   10);
 * }
 * Thank you
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10971600)
 * Yes the new code is current, should be fine with either though. The difference
   is the value set in the third parameter of each `add_filter()` function. Previously
   it was set to 100, but a value of 10 is the default and recommended.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Disable Gutenberg via Code + Plugin’ is closed to new replies.

 * ![](https://ps.w.org/disable-gutenberg/assets/icon-256x256.png?rev=1925990)
 * [Disable Gutenberg](https://wordpress.org/plugins/disable-gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/disable-gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/disable-gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/disable-gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/disable-gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/disable-gutenberg/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/disable-gutenberg-via-code-plugin/#post-10971600)
 * Status: resolved