I have created a custom post type as well as a custom taxonomy, however when I added my first item and selected a category/recipient something weird happened, it automatically created an additional numeric category and changed the selection to that.
The only recipients I had entered were “John” and “Michael”, I selected John and when the page reloaded it had added “13” and had it selected, and every time I update it it adds a new number and selects this new number as the recipient.
It seems the only time it doesn’t add a new number is when I don’t select any recipient.
register_post_type( 'letter', array( 'labels' => array( 'name' => __( 'Letters' ), 'singular_name' => __( 'Letter' ), //.......... ), 'public' => true, 'taxonomies' => array('letter'), //........ ) ); // Our args for the custom taxonomy below $args = array( 'labels' => array( 'name' => __('Recipients'), 'singular_name' => __('Recipient'), //..... ), 'meta_box_cb' => 'post_categories_meta_box', ); // Register a custom taxonomy for our letter categories register_taxonomy( 'recipient', 'letter', $args ); // Connect the post type and taxonomy together to be safe register_taxonomy_for_object_type( 'recipient', 'letter' );
What is going on here and how do I fix it?