Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

property_tax_county

County Taxonomy for CPT Property

if ( ! function_exists( 'property_tax_county' ) ) {

// Register Custom Taxonomy
function property_tax_county() {

	$labels = array(
		'name'                       => _x( 'Counties', 'Taxonomy General Name', 'gum-bcrapp' ),
		'singular_name'              => _x( 'County', 'Taxonomy Singular Name', 'gum-bcrapp' ),
		'menu_name'                  => __( 'County', 'gum-bcrapp' ),
		'all_items'                  => __( 'All Counties', 'gum-bcrapp' ),
		'parent_item'                => __( 'Parent County', 'gum-bcrapp' ),
		'parent_item_colon'          => __( 'Parent County:', 'gum-bcrapp' ),
		'new_item_name'              => __( 'New County', 'gum-bcrapp' ),
		'add_new_item'               => __( 'Add New County', 'gum-bcrapp' ),
		'edit_item'                  => __( 'Edit County', 'gum-bcrapp' ),
		'update_item'                => __( 'Update County', 'gum-bcrapp' ),
		'separate_items_with_commas' => __( 'Separate items with commas', 'gum-bcrapp' ),
		'search_items'               => __( 'Search Counties', 'gum-bcrapp' ),
		'add_or_remove_items'        => __( 'Add or remove counties', 'gum-bcrapp' ),
		'choose_from_most_used'      => __( 'Choose from the most used counties', 'gum-bcrapp' ),
		'not_found'                  => __( 'Not Found', 'gum-bcrapp' ),
	);
	$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( 'county', array( 'property' ), $args );

}

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

}