Plugins like CPT UI are great, but adding code to functions.php is cleaner and faster. It prevents unnecessary database queries.
register_post_type('portfolio', array(
'labels' => array('name' => 'Portfolios'),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail'),
'menu_icon' => 'dashicons-portfolio'
));
Why? Native code is easier to version control and doesn’t break during plugin updates.
