ADDING GUTENBERG SUPPORT TO A CUSTOM POST TYPE

source: https://www.cloudways.com/blog/gutenberg-wordpress-custom-post-type/

‘show_in_rest’ => true,
‘supports’ => array(‘editor’),

Add the code above to your CPT

function create_chapter_post_type() {

$labels = array(
‘name’ => _x( ‘Chapters’, ‘Post Type General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Chapter’, ‘Post Type Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Chapters’, ‘text_domain’ ),
‘name_admin_bar’ => __( ‘Chapter’, ‘text_domain’ ),
‘archives’ => __( ‘Chapter Archives’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Chapter Group:’, ‘text_domain’ ),
‘all_items’ => __( ‘All Chapters’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Chapter’, ‘text_domain’ ),
‘add_new’ => __( ‘New Chapter’, ‘text_domain’ ),
‘new_item’ => __( ‘New Chapter’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Chapter’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Chapter’, ‘text_domain’ ),
‘view_item’ => __( ‘View Chapter’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Chapters’, ‘text_domain’ ),
‘not_found’ => __( ‘Chapter not found’, ‘text_domain’ ),
‘not_found_in_trash’ => __( ‘Not found in Trash’, ‘text_domain’ ),
);
$args = array(
‘label’ => __( ‘Chapter’, ‘text_domain’ ),
‘description’ => __( ‘Chapters post type’, ‘text_domain’ ),
‘labels’ => $labels,
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘post-formats’, ‘revisions’, ‘thumbnail’, ‘chapters_name’, ‘revisions’ ),
‘taxonomies’ => array( ‘chapter-type’, ‘rec-year’ ),
‘public’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘menu_icon’ => ‘dashicons-awards’,
‘show_in_admin_bar’ => true,
‘can_export’ => true,
‘has_archive’ => true,
‘query_var’ => true,
‘capability_type’ => ‘post’,
‘register_meta_box_cb’ => ‘add_chapters_metaboxes’,
‘rewrite’ => array(‘slug’ => ‘chapter’),
);
register_post_type( ‘chapter’, $args );
}
add_action( ‘init’, ‘create_chapter_post_type’, 0 );

Changing this

function create_chapter_post_type() {

$labels = array(
‘name’ => _x( ‘Chapters’, ‘Post Type General Name’, ‘text_domain’ ),
‘singular_name’ => _x( ‘Chapter’, ‘Post Type Singular Name’, ‘text_domain’ ),
‘menu_name’ => __( ‘Chapters’, ‘text_domain’ ),
‘name_admin_bar’ => __( ‘Chapter’, ‘text_domain’ ),
‘archives’ => __( ‘Chapter Archives’, ‘text_domain’ ),
‘parent_item_colon’ => __( ‘Chapter Group:’, ‘text_domain’ ),
‘all_items’ => __( ‘All Chapters’, ‘text_domain’ ),
‘add_new_item’ => __( ‘Add New Chapter’, ‘text_domain’ ),
‘add_new’ => __( ‘New Chapter’, ‘text_domain’ ),
‘new_item’ => __( ‘New Chapter’, ‘text_domain’ ),
‘edit_item’ => __( ‘Edit Chapter’, ‘text_domain’ ),
‘update_item’ => __( ‘Update Chapter’, ‘text_domain’ ),
‘view_item’ => __( ‘View Chapter’, ‘text_domain’ ),
‘search_items’ => __( ‘Search Chapters’, ‘text_domain’ ),
‘not_found’ => __( ‘Chapter not found’, ‘text_domain’ ),
‘not_found_in_trash’ => __( ‘Not found in Trash’, ‘text_domain’ ),
);
$args = array(
‘label’ => __( ‘Chapter’, ‘text_domain’ ),
‘description’ => __( ‘Chapters post type’, ‘text_domain’ ),
‘labels’ => $labels,
‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘post-formats’, ‘revisions’, ‘thumbnail’, ‘chapters_name’, ‘revisions’ ),
‘taxonomies’ => array( ‘chapter-type’, ‘rec-year’ ),
‘public’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘menu_icon’ => ‘dashicons-awards’,
‘show_in_admin_bar’ => true,
‘can_export’ => true,
‘has_archive’ => true,
‘query_var’ => true,
‘show_in_rest’ => true,
‘supports’ => array(‘editor’),
‘capability_type’ => ‘post’,
‘register_meta_box_cb’ => ‘add_chapters_metaboxes’,
‘rewrite’ => array(‘slug’ => ‘chapter’),
);
register_post_type( ‘chapter’, $args );
}
add_action( ‘init’, ‘create_chapter_post_type’, 0 );

to this … then you can use Gutenberg for the main edit field