Custom Taxonomies

When you need more than just ‘categories’ and ‘tags’ use custom taxonomies.

Especially useful in combination with custom post types.

add_action('init', 'my_new_taxonomies');
function my_new_taxonomies() {

	$labels = array(
	'name' => __( 'Action Hooks' ),
	'singular_name' => __( 'Action Hook' ),
	'search_items' =>  __( 'Search Action Hooks' ),
	'popular_items' => __( 'Popular Action Hooks' ),
	'all_items' => __( 'All Action Hooks' ),
	'parent_item' => null,
	'parent_item_colon' => null,
	'edit_item' => __( 'Edit Action Hook' ),
	'update_item' => __( 'Update Action Hook' ),
	'add_new_item' => __( 'Add New Action Hook' ),
	'new_item_name' => __( 'New Action Hook' ),
	'separate_items_with_commas' => __( 'Separate hooks with commas' ),
	'add_or_remove_items' => __( 'Add or remove hooks' ),
	'choose_from_most_used' => __( 'Choose from the most used hooks' ),
	'menu_name' => __( 'Action Hooks' ),
	); 

	register_taxonomy('action_hook','post',array(
	'hierarchical' => false,
	'labels' => $labels,
	'show_ui' => true,
	'query_var' => true,
	'rewrite' => array( 'slug' => 'action_hook' ),
	));
}

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: