Home Features Download v18.5 Child theme GGitHub

Gutenberg

By default, Gutenberg is disabled. You can enable it from the theme options. If you still need Gutenberg disabled, but enabled only for simple posts, use the code below:

// Enable Gutenberg only for simple posts
if (is_admin()) {
  function enable_gutenberg_for_posts_only($use_block_editor, $post) {
    if (is_object($post)) {
      $post_type = get_post_type($post);
    } else {
      $screen = get_current_screen();
      $post_type = $screen ? $screen->post_type : null;
    }
    if ($post_type === 'post') {
      remove_filter('use_block_editor_for_post', '__return_false', 10);
      return true;
    }
    return false;
  }
  add_filter('use_block_editor_for_post', 'enable_gutenberg_for_posts_only', 99, 2);
  add_filter('use_block_editor_for_post_type', 'enable_gutenberg_for_posts_only', 99, 2);
}
🦁 Gridy