Create Custom Taxonomy

Once you create a custom post type, it’s often helpful to allow for a custom taxonomy to be applied to said post type. Again, WordPress makes this fairly simple. Just paste the following into your functions file and modify the “projects” names to be appropriate for you custom post type.

//Add project types
add_action( 'init', 'project_taxonomies', 0 );
function project_taxonomies() {
	$labels = array(
		'name'                => _x( 'Project Type', 'taxonomy general name' ),
		'singular_name'       => _x( 'Project Type', 'taxonomy singular name' ),
		'search_items'        => __( 'Search Project Types' ),
		'all_items'           => __( 'All Project Types' ),
		'parent_item'         => __( 'Parent Project Type' ),
		'parent_item_colon'   => __( 'Parent Project Type:' ),
		'edit_item'           => __( 'Edit Project Type' ), 
		'update_item'         => __( 'Update Project Type' ),
		'add_new_item'        => __( 'Add New Project Type' ),
		'new_item_name'       => __( 'New Project Type' ),
		'menu_name'           => __( 'Project Type' )
	);
	 $args = array(
		'hierarchical'        => true,
		'labels'              => $labels,
		'show_ui'             => true,
		'show_admin_column'   => true,
		'query_var'           => true,
		'rewrite'             => array( 'slug' => 'project-type' )
	  );
	  register_taxonomy( 'project-type', array( 'projects' ), $args );
}