Thanks for your prompt response!
Here’s my code:
function my_custom_posttypes() {
// Studies Post Type
$labels = array(
‘name’ => ‘Studies’,
‘singular_name’ => ‘Study’,
‘menu_name’ => ‘Studies’,
‘name_admin_bar’ => ‘Study’,
‘add_new’ => ‘Add New’,
‘add_new_item’ => ‘Add New Study’,
‘new_item’ => ‘New Study’,
‘edit_item’ => ‘Edit Study’,
‘view_item’ => ‘View Study’,
‘all_items’ => ‘All Studies’,
‘search_items’ => ‘Search Studies’,
‘parent_item_colon’ => ‘Parent Studies:’,
‘not_found’ => ‘No Studies found.’,
‘not_found_in_trash’ => ‘No Studies found in Trash.’,
);
$args = array(
‘labels’ => $labels,
‘public’ => true,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_icon’ => ‘dashicons-id-alt’,
‘query_var’ => true,
‘rewrite’ => array( ‘slug’ => ‘studies’ ),
‘capability_type’ => ‘post’,
‘has_archive’ => true,
‘hierarchical’ => false,
‘menu_position’ => 3,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’),
‘taxonomies’ => array( ‘category’ ),
‘show_in_rest’ => true
);
register_post_type( ‘studies’, $args );
}
add_action( ‘init’, ‘my_custom_posttypes’ );
// Flush rewrite rules to add “Studies” as a permalink slug
function my_rewrite_flush() {
my_custom_posttypes();
flush_rewrite_rules();
}
register_activation_hook( __FILE__, ‘my_rewrite_flush’ );