Opened 3 years ago
Last modified 12 months ago
#14691 new enhancement
Allow commas in tag names
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Taxonomy | Version: | 3.0.1 |
| Severity: | normal | Keywords: | has-patch needs-testing needs-unit-tests |
| Cc: | ngomau@…, abackstrom |
Description
Adding tags to posts via the web interface involves a lot of what boils down to
explode( ',', join( ',', array( $tag_name, ... ) ) );
both in PHP and JS.
We settled on commas so we could have tags with spaces in them (see #10320, for example).
It'd be nice if tags (and other taxonomies) could have commas in them, though. Example use case: normalized locations ("Portland, OR"). Admittedly, commas in tag names is an edge case.
The attached treats tag inputs as "real" CSV strings instead of just exploding by commas.
That way, you can enter:
hello, "hello, world"
in the tags input field and the following tags would be added to the post.
- hello
- hello, world
This addresses commas in tag names but makes entering double quotes in tag names more annoying. If you wanted a tag named double"quote, you'd have to enter the following.
"double""quote"
This may also help with #7897.
Attachments (1)
Change History (10)
comment:3
follow-up:
↓ 5
Denis-de-Bernardy — 3 years ago
- Keywords needs-unit-tests added
Replying to Denis-de-Bernardy:
I'm not too worried if fgetcsv/fputcsv don't quite meet the spec as long as they're each other's inverses and that the JS code is compatible enough. I don't know if either is the case.
I agree it needs unit testing, thanks for the tag.
Replying to mdawaffe:
The patch makes use of a slightly modified version of http://www.bennadel.com/blog/1504-Ask-Ben-Parsing-CSV-Strings-With-Javascript-Exec-Regular-Expression-Command.htm
I've emailed the author asking him under what license the code was released.
Ben Nadel, the author, says the code can be used however WP may like to use it. If WP needs an explicit license, he's happy to give it.
comment:9
abackstrom — 12 months ago
- Cc abackstrom added

The patch makes use of a slightly modified version of http://www.bennadel.com/blog/1504-Ask-Ben-Parsing-CSV-Strings-With-Javascript-Exec-Regular-Expression-Command.htm
I've emailed the author asking him under what license the code was released.