Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Filters Taxonomy

aa_filter Taxonomy with filter as slug.

if ( ! function_exists( 'aa_filter_taxonomy' ) ) {

// Register Custom Taxonomy
function aa_filter_taxonomy() {

	$labels = array(
		'name'                       => _x( 'Filters', 'Taxonomy General Name', 'AA_Theme' ),
		'singular_name'              => _x( 'Filter', 'Taxonomy Singular Name', 'AA_Theme' ),
		'menu_name'                  => __( 'Filters', 'AA_Theme' ),
		'all_items'                  => __( 'All Filters', 'AA_Theme' ),
		'parent_item'                => __( 'Parent Filter', 'AA_Theme' ),
		'parent_item_colon'          => __( 'Parent Filter:', 'AA_Theme' ),
		'new_item_name'              => __( 'New Filter Name', 'AA_Theme' ),
		'add_new_item'               => __( 'Add New Filter', 'AA_Theme' ),
		'edit_item'                  => __( 'Edit Filter', 'AA_Theme' ),
		'update_item'                => __( 'Update Filter', 'AA_Theme' ),
		'separate_items_with_commas' => __( 'Separate Filters with commas', 'AA_Theme' ),
		'search_items'               => __( 'Search Filters', 'AA_Theme' ),
		'add_or_remove_items'        => __( 'Add or remove Filters', 'AA_Theme' ),
		'choose_from_most_used'      => __( 'Choose from the most used Filter', 'AA_Theme' ),
		'not_found'                  => __( 'Not Found', 'AA_Theme' ),
	);
	$rewrite = array(
		'slug'                       => 'filter',
		'with_front'                 => true,
		'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,
	);
	register_taxonomy( 'aa_filter', array( 'aa_portfolio' ), $args );

}

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

}