custom taxonomy tags turn into numbers
-
I have a site with a custom post type and a custom taxonomy for that post type.
My post type is Procedures, my taxonomy is Areas.
My problem is that I can’t select an area for a procedure—when I do, and save, I my area has changed to a new tag with a number instead of a name.
This is the function that registers the CPT:
add_action( 'init', 'register_cpt_procedure' ); function register_cpt_procedure() { $labels = array( 'name' => 'Procedures', 'singular_name' => 'Procedure', 'all_items' => 'All Procedures', 'add_new' => 'Add New', 'add_new_item' => 'Add New Procedure', 'edit_item' => 'Edit Procedure', 'new_item' => 'New Procedure', 'view_item' => 'View Procedure', 'search_items' => 'Search Procedure', 'not_found' => 'No Procedure content found', 'not_found_in_trash' => 'No Procedure content found in Trash', 'parent_item_colon' => 'Parent Procedure item:', 'menu_name' => 'Procedures' ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => 'Procedure Custom Post Type', 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields' ), 'taxonomies' => array('area'), 'add_new' => 'Add New', 'procedure', 'add_new_item' => 'Add New Procedure', 'new_item' => 'New Procedure', 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post', 'has_archive' => true ); register_post_type( 'procedure', $args ); }
And the code that registers the taxonomy:
add_action( 'init', 'create_procedure_taxonomy', 0 ); function create_procedure_taxonomy() { register_taxonomy( 'area', array( 'procedure' ), array( 'labels' => array( 'name' => 'Areas', 'singular_name' => 'Area' ), 'rewrite' => array( 'slug' => 'area' ), 'hierarchical' => false, 'meta_box_cb' => 'post_categories_meta_box', 'public' => 'true' ) ); } register_taxonomy_for_object_type( 'area', 'procedures' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘custom taxonomy tags turn into numbers’ is closed to new replies.