Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Places Categories

Linked with place_type custom post type

// Register Custom Taxonomy
function place_category_taxonomy() {

	$labels = array(
		'name'                       => _x( 'Place Categories', 'Taxonomy General Name', 'places_type' ),
		'singular_name'              => _x( 'Place Category', 'Taxonomy Singular Name', 'places_type' ),
		'menu_name'                  => __( 'Place Category', 'places_type' ),
		'all_items'                  => __( 'All Place Categories', 'places_type' ),
		'parent_item'                => __( 'Parent Category', 'places_type' ),
		'parent_item_colon'          => __( 'Parent Category:', 'places_type' ),
		'new_item_name'              => __( 'New Place Category Name', 'places_type' ),
		'add_new_item'               => __( 'Add New Category', 'places_type' ),
		'edit_item'                  => __( 'Edit Place Category', 'places_type' ),
		'update_item'                => __( 'Update Place Category', 'places_type' ),
		'separate_items_with_commas' => __( 'Separate Categories with commas', 'places_type' ),
		'search_items'               => __( 'Search Place Categories', 'places_type' ),
		'add_or_remove_items'        => __( 'Add or remove Place Categories', 'places_type' ),
		'choose_from_most_used'      => __( 'Choose from the most used Place Categories', 'places_type' ),
		'not_found'                  => __( 'Not Found', 'places_type' ),
	);
	$rewrite = array(
		'slug'                       => 'place',
		'with_front'                 => false,
		'hierarchical'               => true,
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'rewrite'                    => $rewrite,
	);
	register_taxonomy( 'place_category', array( 'place_type' ), $args );

}

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