Skip to content

Instantly share code, notes, and snippets.

@LeoLopesWeb
Last active July 12, 2019 17:39
Show Gist options
  • Save LeoLopesWeb/eb4a59b0de5fbc12da6968418870c54c to your computer and use it in GitHub Desktop.
Save LeoLopesWeb/eb4a59b0de5fbc12da6968418870c54c to your computer and use it in GitHub Desktop.
// Disable Gutenberg Completely
// disable for posts
add_filter('use_block_editor_for_post', '__return_false', 10);
// disable for post types
add_filter('use_block_editor_for_post_type', '__return_false', 10);
//Disable Gutenberg for Custom Post Types
function disable_gutenberg_page($is_enabled, $post_type) {
if ($post_type === 'page') return false;
return $is_enabled;
}
add_filter('use_block_editor_for_post_type', 'disable_gutenberg_page', 10, 2);
function disable_gutenberg_block($is_enabled, $post_type) {
if ($post_type === 'blocks') return false;
return $is_enabled;
}
add_filter('use_block_editor_for_post_type', 'disable_gutenberg_block', 10, 2);
@artmaug
Copy link

artmaug commented Jul 12, 2019

Works perfect, thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment