I need to allow comma in custom taxonomy, when I add some values in the administration.
I have a custom taxonomy "Location" and want to add this kind of value : "New York, NY" from a post. But if I use comma, WordPress splits my value into 2 terms. It works only if I add a value from the taxonomy page:
I tried the solutions on these posts:
https://wordpress.stackexchange.com/questions/25043/how-can-i-allow-commas-in-tag-names
But nothing seems to work.
Maybe a possible solution would be to replace the "," with a ";" to split multiple terms.
Register taxonomy code:
register_taxonomy(
'locations',
'positions',
array(
'label' => 'Locations',
'labels' => array(
'name' => 'Locations',
'singular_name' => 'Location',
'all_items' => 'All locations',
'edit_item' => 'Edit the location',
'view_item' => 'See the location',
'update_item' => 'Update the location',
'add_new_item' => 'Add a location',
'new_item_name' => 'New location',
'search_items' => 'Search for a location',
'popular_items' => 'Popular locations'
),
'hierarchical' => true
)
);
register_taxonomy_for_object_type('locations', 'positions');