Please replace the “portfolio_create_taxonomy” funcation to below code
function portfolio_create_taxonomy() {
register_taxonomy(
'portfolio-category',
array( 'portfolio' ),
array(
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'label' => __( 'Category' ),
'rewrite' => array( 'slug' => 'portfolio-category' ),
'hierarchical' => true,
)
);
}
add_action( 'init', 'portfolio_create_taxonomy' );