Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Locations Taxonomy

if ( ! function_exists( 'register_locations_taxonomy' ) ) {

// Register Custom Taxonomy
function register_locations_taxonomy() {

	$labels = array(
		'name'                       => _x( 'Locations', 'Taxonomy General Name', 'world_of_waterfalls' ),
		'singular_name'              => _x( 'Location', 'Taxonomy Singular Name', 'world_of_waterfalls' ),
		'menu_name'                  => __( 'Locations', 'world_of_waterfalls' ),
		'all_items'                  => __( 'All Locations', 'world_of_waterfalls' ),
		'parent_item'                => __( 'Parent Location', 'world_of_waterfalls' ),
		'parent_item_colon'          => __( 'Parent Location:', 'world_of_waterfalls' ),
		'new_item_name'              => __( 'New Location Name', 'world_of_waterfalls' ),
		'add_new_item'               => __( 'Add New Location', 'world_of_waterfalls' ),
		'edit_item'                  => __( 'Edit Location', 'world_of_waterfalls' ),
		'update_item'                => __( 'Update Location', 'world_of_waterfalls' ),
		'view_item'                  => __( 'View Location', 'world_of_waterfalls' ),
		'separate_items_with_commas' => __( 'Separate locations with commas', 'world_of_waterfalls' ),
		'add_or_remove_items'        => __( 'Add or remove locations', 'world_of_waterfalls' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'world_of_waterfalls' ),
		'popular_items'              => __( 'Popular Locations', 'world_of_waterfalls' ),
		'search_items'               => __( 'Search Locations', 'world_of_waterfalls' ),
		'not_found'                  => __( 'Not Found', 'world_of_waterfalls' ),
		'no_terms'                   => __( 'No Locations', 'world_of_waterfalls' ),
		'items_list'                 => __( 'Locations list', 'world_of_waterfalls' ),
		'items_list_navigation'      => __( 'Locations list navigation', 'world_of_waterfalls' ),
	);
	$rewrite = array(
		'slug'                       => 'location',
		'with_front'                 => true,
		'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( 'location', array( 'waterfalls' ), $args );

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

}