Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Regions Taxonomy

The Regions taxonomy is used with the Locations custom post type to describe where a location is.

if ( ! function_exists( 'hms_taxonomies' ) ) {

// Register Custom Taxonomy
function hms_taxonomies() {

	$labels = array(
		'name'                       => _x( 'Regions', 'Taxonomy General Name', 'hms-custom-post-types' ),
		'singular_name'              => _x( 'Region', 'Taxonomy Singular Name', 'hms-custom-post-types' ),
		'menu_name'                  => __( 'Regions', 'hms-custom-post-types' ),
		'all_items'                  => __( 'All Regions', 'hms-custom-post-types' ),
		'parent_item'                => __( 'State Location', 'hms-custom-post-types' ),
		'parent_item_colon'          => __( 'State Location:', 'hms-custom-post-types' ),
		'new_item_name'              => __( 'New Region Name', 'hms-custom-post-types' ),
		'add_new_item'               => __( 'Add New Region', 'hms-custom-post-types' ),
		'edit_item'                  => __( 'Edit Region', 'hms-custom-post-types' ),
		'update_item'                => __( 'Update Regions', 'hms-custom-post-types' ),
		'view_item'                  => __( 'View Region', 'hms-custom-post-types' ),
		'separate_items_with_commas' => __( 'Separate regions with commas', 'hms-custom-post-types' ),
		'add_or_remove_items'        => __( 'Add or remove regions', 'hms-custom-post-types' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'hms-custom-post-types' ),
		'popular_items'              => __( 'Popular Regions', 'hms-custom-post-types' ),
		'search_items'               => __( 'Search Regions', 'hms-custom-post-types' ),
		'not_found'                  => __( 'Regions Not Found', 'hms-custom-post-types' ),
		'no_terms'                   => __( 'No Regions', 'hms-custom-post-types' ),
		'items_list'                 => __( 'Regions list', 'hms-custom-post-types' ),
		'items_list_navigation'      => __( 'Regions list navigation', 'hms-custom-post-types' ),
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
	);
	register_taxonomy( 'regions', array( 'locations' ), $args );

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

}