Selectively Disable Gutenberg

Like many developers, I have a starter theme. Mine’s called Origin. It has a lot of stuff specific to a particular type of project I do often, so it’s not open source. But, there’s a lot of gems there which may be useful to others.

I’m going to start sharing them here, and add some Category nav items to the header so they’re easier to find.


Let’s say you’re not totally against Gutenberg, and want it to be used in a few places. The way WP lets you do this, is to disable it by post type.

In the example below, it’s disabled on the page, career and casestudy post types I have in a current project.

Pro tip: Unlike a lot of WP filters, you can use post as a type to disable.

function origin_disable_gutenberg($use_block_editor, $post_type) {
  $disabled_types = array(
    'page',
    'career',
    'casestudy'
  );

  if (in_array($post_type, $disabled_types)) :
    return false;
  endif;

  return $use_block_editor;
}
add_filter('use_block_editor_for_post_type', 'origin_disable_gutenberg', 10, 2);