WP register_post_type() with custom CMB2 meta box
functions.php register_post_type('portfolio',[ 'labels'=>[ 'name'=> 'Portfolio', 'add_new_item'=>'Add new portfolio', 'view_item'=>'View portfolio', ], 'public'=>true, 'menu_icon'=>'dashicons-edit', 'menu_position'=>1, 'supports'=> ['title','editor','thumbnail'] ]); custom.php add_action('cmb2_admin_init','custom_metaboxes'); function custom_metaboxes(){ $portfolioMetaBox = new_cmb2_box([ 'object_types'=>['portfolio'], 'id'=>'portfolio-additional-fields', 'title'=>'Portfolio Additional Fields' ]); $portfolioMetaBox->add_field([ 'id'=>'portfolio_designation', 'name'=>'Portfoilo Designation', 'type'=>'text' ]); $portfolioMetaBox->add_field([ ...