Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Labels

if ( ! function_exists( 'addLabelsTaxonomy' ) ) {

// Register Custom Taxonomy
function addLabelsTaxonomy() {

	$labels = array(
		'name'                       => _x( 'Labels', 'Taxonomy General Name', 'pthq' ),
		'singular_name'              => _x( 'Label', 'Taxonomy Singular Name', 'pthq' ),
		'menu_name'                  => __( 'Label', 'pthq' ),
		'all_items'                  => __( 'All Labels', 'pthq' ),
		'parent_item'                => __( 'Parent Label', 'pthq' ),
		'parent_item_colon'          => __( 'Parent Label:', 'pthq' ),
		'new_item_name'              => __( 'New Label Name', 'pthq' ),
		'add_new_item'               => __( 'Add New Label', 'pthq' ),
		'edit_item'                  => __( 'Edit Label', 'pthq' ),
		'update_item'                => __( 'Update Label', 'pthq' ),
		'view_item'                  => __( 'View Label', 'pthq' ),
		'separate_items_with_commas' => __( 'Separate labels with commas', 'pthq' ),
		'add_or_remove_items'        => __( 'Add or remove labels', 'pthq' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'pthq' ),
		'popular_items'              => __( 'Popular Labels', 'pthq' ),
		'search_items'               => __( 'Search Labels', 'pthq' ),
		'not_found'                  => __( 'Not Found', 'pthq' ),
		'no_terms'                   => __( 'No labels', 'pthq' ),
		'items_list'                 => __( 'Labels list', 'pthq' ),
		'items_list_navigation'      => __( 'Labels list navigation', 'pthq' ),
	);
	$capabilities = array(
		'manage_terms'               => 'manage_labels',
		'edit_terms'                 => 'manage_labels',
		'delete_terms'               => 'manage_labels',
		'assign_terms'               => 'edit_projects',
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => false,
		'capabilities'               => $capabilities,
	);
	register_taxonomy( 'labels', array( 'project' ), $args );

}
add_action( 'init', 'addLabelsTaxonomy', 0 );

}