Custom Taxonomy
-
Hi,
I am trying to create a custom taxonomy (like category) for only the location.
I get it to show in the location-edit-page and working with this code:
// hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'location', 0 ); // create two taxonomies, genres and writers for the post type "book" function location() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Genres', 'taxonomy general name', 'textdomain' ), 'singular_name' => _x( 'Genre', 'taxonomy singular name', 'textdomain' ), 'search_items' => __( 'Search Genres', 'textdomain' ), 'all_items' => __( 'All Genres', 'textdomain' ), 'parent_item' => __( 'Parent Genre', 'textdomain' ), 'parent_item_colon' => __( 'Parent Genre:', 'textdomain' ), 'edit_item' => __( 'Edit Genre', 'textdomain' ), 'update_item' => __( 'Update Genre', 'textdomain' ), 'add_new_item' => __( 'Add New Genre', 'textdomain' ), 'new_item_name' => __( 'New Genre Name', 'textdomain' ), 'menu_name' => __( 'Genre', 'textdomain' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_in_menu' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'genre' ),); register_taxonomy( 'genre', array( 'location' ), $args );}
…but then it does not show in the admin-side-panel. When I add ‘your’ code, it shows and works in the admin-side-panel, but then the custom category also shows in event-edit-page. When I delete the first register_etc…EM_POST_TYPE_EVENT it does not show in admin-side-panel! So how can I register the custom-taxonomy for location only and show it in admin-side-panel??
function my_em_own_taxonomy_register(){ register_taxonomy_for_object_type('genre',EM_POST_TYPE_EVENT); register_taxonomy_for_object_type('genre',EM_POST_TYPE_LOCATION); } add_action('init','my_em_own_taxonomy_register',100);
Thanks, Roos
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Custom Taxonomy’ is closed to new replies.