Custom post types create new content types — register with register_post_type() and set show_in_rest.
Custom Post Types (CPT)
[
'name' => 'Portfolio',
'singular_name' => 'Project',
'add_new_item' => 'Add New Project',
],
'public' => true,
'has_archive' => true,
'show_in_rest' => true, // enables Gutenberg + REST API
'menu_icon' => 'dashicons-portfolio',
'supports' => ['title','editor','thumbnail','excerpt'],
'rewrite' => ['slug' => 'portfolio'],
]);
}
add_action('init', 'register_portfolio_cpt');
// After registering: flush permalinks
// Settings > Permalinks > Save Changes
// Or: flush_rewrite_rules();