The problem is your code is using ‘Curley quotes’ which is probably something the tutorials cms converted automatically (WordPress…).
‘show_in_rest’ => true
You need to change these to single quotes:
'show_in_rest' => true
Full code:
<?php
/*
Plugin Name: Register Custom Post Types
*/
function goldnuggs_register_post_type() {
$labels = array(
'name' => __( 'Case-studies', 'goldnuggs' ),
'singular_name' => __( 'Case Study', 'goldnuggs' ),
'add_new' => __( 'New Case Study', 'goldnuggs' ),
'add_new_item' => __( 'Add New Case Study', 'goldnuggs' ),
'edit_item' => __( 'Edit Case Study', 'goldnuggs' ),
'new_item' => __( 'New Case Study', 'goldnuggs' ),
'view_item' => __( 'View Case Studies', 'goldnuggs' ),
'search_items' => __( 'Search Case Studies', 'goldnuggs' ),
'not_found' => __( 'No Case Studies Found', 'goldnuggs' ),
'not_found_in_trash' => __( 'No Case Studies found in Trash', 'goldnuggs' ),
);
$args = array(
'labels' => $labels,
'has_archive' => true,
'public' => true,
'hierarchical' => false,
'supports' => array(
'title',
'editor',
'excerpt',
'custom-fields',
'thumbnail',
'page-attributes'
),
'taxonomies' => 'category',
'rewrite' => array( 'slug' => 'case-study' ),
'show_in_rest' => true
);
register_post_type( 'goldnugg_case', $args );
}
add_action( 'init', 'goldnuggs_register_post_type' );