// Register our Team post type
add_action( 'init', 'create_custom_post_type', 0 );

function create_custom_post_type() {

// Set UI labels for custom post type
array(

'name' => _x( 'CPT Name', 'Post Type General Name' ),
'singular_name' => _x( 'CPT Name', 'Post Type Singular Name' ),
'menu_name' => __( 'CPT' ),
'parent_item_colon' => __( 'Parent CPT' ),
'all_items' => __( 'All CPT' ),
'view_item' => __( 'View CPT' ),
'add_new_item' => __( 'Add New CPT Name' ),
'add_new' => __( 'Add New CPT Name' ),
'edit_item' => __( 'Edit CPT Name' ),
'update_item' => __( 'Update CPT Name' ),
'search_items' => __( 'Search CPT Name' ),
'not_found' => __( 'Not Found' ),
'not_found_in_trash' => __( 'Not found in Trash' ),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'CPT Name'),

);

// To prevent any error, make sure this post type doesn't exist

if ( post_type_exists( 'CPT Name' ) ) {

// This should throw a WP Error if Team is already registered, more here: https://codex.wordpress.org/Class_Reference/WP_Error

return new WP_Error( 'Ooops', __( "This post type is already registered", "my_textdomain" ) );

}else{

// If this post type dosn't exist, register the Team post type

register_post_type( 'CPT Name');

}

}