WordPress made some great addition to its features, this is great effort and made a good review from other but not from many particularly to the developers. Around 98% of WordPress users pike Gutenberg and setup  without the plugin. Gutenberg refused to activate and reactivate classic version of WordPress text editor.

This blogger often use the following older version code that still won’t affect disabling Gutenberg in multiple post page.

// Post editor 
add_filter('use_block_editor_for_post', '__return_false', 10); 

// Page editor 
add_filter('use_block_editor_for_post_type', '__return_false', 10);

Some WordPress theme frameworks ignoring the code above to work on custom post types.

Creating a statement recalling global variable $post_type like the code below relies to declared specific custom post-type.

function taxo_disable_gutenberg($is_enabled, $post_type) {
	
	if ($post_type === 'Portfolio') return false;
	
	return $is_enabled;
}
add_filter('use_block_editor_for_post_type', 'taxo_disable_gutenberg', 10, 2);

Instead of making a single target to disable Gutenberg in a WordPress theme with multiple post-types built-in like Portfolio, Services, Books, Movies, and etc., why not use array() like the following code:

$args = array( 'post_type' => 'portfolio','services','book','movie');

function no_to_gutenberg( $is_enabled, $post_type) {

  if ($post_type === $args ) return false;

  $is_enabled;

}
add_filter('use_block_editor_for_post_type', 'no_to_gutenberg', 10, 2);

Thank you for reading this article. If you have a questions, don’t hesitate to comment down. Also, subscribe to receive new updates.

Other methods as well as conditional statements for disabling Gutenberg can be found at DigWp that you may read.

Advertisements