Skip to content

Instantly share code, notes, and snippets.

@madysondesigns
Created October 16, 2012 16:23
Show Gist options
  • Save madysondesigns/3900340 to your computer and use it in GitHub Desktop.
Save madysondesigns/3900340 to your computer and use it in GitHub Desktop.
Have two taxonomies. Both work in WP admin, and can be displayed with get_the_term_list(). But one won't work with wp_tag_cloud().
Working taxonomy:
add_action( 'init', 'create_post_flags' );
function create_post_flags() {
$labels = array(
'name' => _x( 'Post Flags', 'taxonomy general name' ),
'singular_name' => _x( 'Post Flag', 'taxonomy singular name' ),
'search_items' => __( 'Search Post Flags' ),
'all_items' => __( 'All Post Flags' ),
'parent_item' => __( 'Parent Flag' ),
'parent_item_colon' => __( 'Parent Flag:' ),
'edit_item' => __( 'Edit Post Flag' ),
'update_item' => __( 'Update Post Flag' ),
'add_new_item' => __( 'Add New Post Flag' ),
'new_item_name' => __( 'New Post Flag Name' ),
);
register_taxonomy('post_flags','post',array(
'hierarchical' => true,
'labels' => $labels
));
}
Broken taxonomy:
add_action( 'init', 'create_test_taxonomies' );
function create_test_taxonomies()
{
$labels = array(
'name' => _x( 'Test Tax', 'taxonomy general name' ),
'singular_name' => _x( 'Test Tax', 'taxonomy singular name' ),
'search_items' => __( 'Search Test Tax' ),
'all_items' => __( 'All Test Tax' ),
'parent_item' => __( 'Parent Test Tax' ),
'parent_item_colon' => __( 'Parent Test Tax:' ),
'edit_item' => __( 'Edit Test Tax' ),
'update_item' => __( 'Update Test Tax' ),
'add_new_item' => __( 'Add New Test Tax' ),
'new_item_name' => __( 'New Genre Test Tax' ),
'menu_name' => __( 'Test Tax' ),
);
register_taxonomy('test_tax','post',array(
'hierarchical' => true,
'labels' => $labels
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment