Skip to content

Instantly share code, notes, and snippets.

@mmilosheski
Created October 25, 2018 15:14
Show Gist options
  • Save mmilosheski/7c4df4e44ffb8c0023a7fde30241ca64 to your computer and use it in GitHub Desktop.
Save mmilosheski/7c4df4e44ffb8c0023a7fde30241ca64 to your computer and use it in GitHub Desktop.
/*
* Disable Gutenberg globally
*/
add_filter( 'use_block_editor_for_post', '__return_false' );
/*
* Disable Gutenberg for specific post types
*/
function disable_block_editor_cpt( $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', 'disable_block_editor_cpt', 10, 2 );
@artmaug
Copy link

artmaug commented Jul 15, 2019

Thanks a lot, works like a charm

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