Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Zink – State Taxonomy

// Register Custom Taxonomy
function state_taxonomy() {

	$labels = array(
		'name'                       => _x( 'States', 'Taxonomy General Name', 'sage' ),
		'singular_name'              => _x( 'State', 'Taxonomy Singular Name', 'sage' ),
		'menu_name'                  => __( 'State', 'sage' ),
		'all_items'                  => __( 'All States', 'sage' ),
		'parent_item'                => __( 'Parent State', 'sage' ),
		'parent_item_colon'          => __( 'Parent State:', 'sage' ),
		'new_item_name'              => __( 'New State Name', 'sage' ),
		'add_new_item'               => __( 'Add New State', 'sage' ),
		'edit_item'                  => __( 'Edit State', 'sage' ),
		'update_item'                => __( 'Update State', 'sage' ),
		'view_item'                  => __( 'View State', 'sage' ),
		'separate_items_with_commas' => __( 'Separate states with commas', 'sage' ),
		'add_or_remove_items'        => __( 'Add or remove states', 'sage' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'sage' ),
		'popular_items'              => __( 'Popular Items', 'sage' ),
		'search_items'               => __( 'Search Items', 'sage' ),
		'not_found'                  => __( 'Not Found', 'sage' ),
		'no_terms'                   => __( 'No items', 'sage' ),
		'items_list'                 => __( 'Items list', 'sage' ),
		'items_list_navigation'      => __( 'Items list navigation', 'sage' ),
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'show_in_rest'               => true,
	);
	register_taxonomy( 'state', array( 'representative' ), $args );

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