Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable Gutenberg globally or for specific post types for WordPress 5.0 and UP
<?php
/*
* Disable Gutenberg globally
* use this if you prefer one-liner
* add_filter('use_block_editor_for_post', '__return_false');
*/
function _thz_filter_disable_block_editor(){
return false;
}
add_filter( 'use_block_editor_for_post', '_thz_filter_disable_block_editor' );
/*
* Disable Gutenberg for specific post types
*/
function _thz_filter_disable_block_editor_pt( $use_block_editor, $post_type ){
if( 'page' == $post_type || 'post' == $post_type){
$use_block_editor = false;
}
return $use_block_editor;
}
add_filter( 'use_block_editor_for_post_type', '_thz_filter_disable_block_editor_pt', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment