It is possible and very easy to save tags with commas programmatically.
When you call wp_set_post_terms( $post_id, $terms, $taxonomy )If you deliver a string, it will be exploded in an array. If you are your $terms If an array is provided in the array, each item is provided as its own term without splitting into several terms.
// Example term with comma.
$terms="Surname, Given Names";
// Creates and/or assigns multiple terms separated by a comma.
wp_set_post_terms( $post_id, $terms, $taxonomy );
// Creates and/or assigns a single term with a comma.
wp_set_post_terms( $post_id, (array) $terms, $taxonomy );
Both wp_insert_post and then wp_update_post usage wp_set_post_terms When the $arg tax_input is set.
// Ensure $terms is an array.
$args['tax_input'][$taxonomy] = (array) $terms;
$post_id = wp_insert_post( $args );
The best way to create terms on the spot using the WordPress Dashboard UI, you may be able to create your own meta box that submits each string, including commas as a single term. Some plug -in, such as ACF Pro, do this as standard when you make an adapted field to save the taxonomy and select to also load the conditions and to allocate when stored.
/* Example JSON config snippet for an ACF Pro Export/Import. */
/* Most likely config for most of these situations: "allow_null" */
/* and "field_type" may need to be adjusted depending on the situation. */
{
"type": "taxonomy",
"field_type": "multi_select",
"allow_null": 1,
"add_term": 1,
"save_terms": 1,
"load_terms": 1
}
Even when saved with a comma, each part of those conditions with commas can still appear as individual items when editing the message. In this case it can be best to disable the standard onion and to rely on the adapted meta subjects. This can be done using screen options when editing a postal type. Custom taxonomies can also be hidden from the rapid editing section when they are registered.
// Register Custom Taxonomy args - disable default UI in quick edit.
$args['show_in_quick_edit'] = false;
register_taxonomy( $taxonomy, (array) $post_types, $args );
#commas #tagnamen

