Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Metal Product Taxonomy

if ( ! function_exists( 'metal_products_tax' ) ) {

// Register Custom Taxonomy
function metal_products_tax() {

	$labels = array(
		'name'                       => _x( 'Metal Product Types', 'Taxonomy General Name', 'metal_products_tax' ),
		'singular_name'              => _x( 'Metal Product Type', 'Taxonomy Singular Name', 'metal_products_tax' ),
		'menu_name'                  => __( 'Metal Product Type', 'metal_products_tax' ),
		'all_items'                  => __( 'All Metal Product Types', 'metal_products_tax' ),
		'parent_item'                => __( 'Parent Metal Product Type', 'metal_products_tax' ),
		'parent_item_colon'          => __( 'Parent Metal Product Type:', 'metal_products_tax' ),
		'new_item_name'              => __( 'New Item Name', 'metal_products_tax' ),
		'add_new_item'               => __( 'Add New Metal Product Type', 'metal_products_tax' ),
		'edit_item'                  => __( 'Edit Metal Product Type', 'metal_products_tax' ),
		'update_item'                => __( 'Update Metal Product Type', 'metal_products_tax' ),
		'view_item'                  => __( 'View Metal Product Type', 'metal_products_tax' ),
		'separate_items_with_commas' => __( 'Separate Metal Product Types with commas', 'metal_products_tax' ),
		'add_or_remove_items'        => __( 'Add or remove Metal Product Types', 'metal_products_tax' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'metal_products_tax' ),
		'popular_items'              => __( 'Popular Metal Product Type', 'metal_products_tax' ),
		'search_items'               => __( 'Search Metal Product Types', 'metal_products_tax' ),
		'not_found'                  => __( 'Not Found', 'metal_products_tax' ),
		'no_terms'                   => __( 'No Metal Product Types', 'metal_products_tax' ),
		'items_list'                 => __( 'Metal Product Types list', 'metal_products_tax' ),
		'items_list_navigation'      => __( 'Metal Product Types list navigation', 'metal_products_tax' ),
	);
	$rewrite = array(
		'slug'                       => 'type',
		'with_front'                 => false,
		'hierarchical'               => false,
	);
	$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,
		'show_in_rest'               => true,
	);
	register_taxonomy( 'metal_product_type', array( 'metal_product' ), $args );

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

}