Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Sharan Cities Taxonomy

// Register Custom Taxonomy
function register_city_taxonomy() {

	$labels = array(
		'name'                       => _x( 'Cities', 'Taxonomy General Name', 'sharan' ),
		'singular_name'              => _x( 'City', 'Taxonomy Singular Name', 'sharan' ),
		'menu_name'                  => __( 'City', 'sharan' ),
		'all_items'                  => __( 'All Cities', 'sharan' ),
		'parent_item'                => __( 'Parent City', 'sharan' ),
		'parent_item_colon'          => __( 'Parent City:', 'sharan' ),
		'new_item_name'              => __( 'New City Name', 'sharan' ),
		'add_new_item'               => __( 'Add New City', 'sharan' ),
		'edit_item'                  => __( 'Edit City', 'sharan' ),
		'update_item'                => __( 'Update City', 'sharan' ),
		'separate_items_with_commas' => __( 'Separate cities with commas', 'sharan' ),
		'search_items'               => __( 'Search Cities', 'sharan' ),
		'add_or_remove_items'        => __( 'Add or remove cities', 'sharan' ),
		'choose_from_most_used'      => __( 'Choose from the most used cities', 'sharan' ),
		'not_found'                  => __( 'City Not Found', 'sharan' ),
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
	);
	register_taxonomy( 'city', 'custom_post_type', $args );

}

// Hook into the 'init' action
add_action( 'init', 'register_city_taxonomy', 0 );