Opened 4 years ago
Last modified 17 months ago
#10792 new enhancement
ampersands and slashes stripped out of slugs
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Future Release |
| Component: | Formatting | Version: | |
| Severity: | trivial | Keywords: | has-patch needs-refresh |
| Cc: |
Description
In slugs for taxonomies or post permalinks, slashes (/\) and ampersands (&) are stripped out. More useful URLs would be created by turning slashes into hyphens, and ampersands into the word "and".
e.g.:
"songs by Lennon/McCartney"
expected slug: "songs-by-lennon-mccartney"
actual slug: "songs-by-lennonmccartney"
"Us & Them"
expected slug: "us-and-them"
actual slug: "us-them"
Attachments (1)
Change History (10)
This patch doesn't extend the ampersand fix to category/tag slugs (but the slash fix works). Perhaps ampersands are being stripped out before the title hits sanitize_title_with_dashes() ? I haven't dug around enough yet...
- Milestone changed from Unassigned to Future Release
Agree with the slash replacement.
Don't agree with the & replacement due to internationalization problems: if you write a blog in french, you won't want '&' to be replaced with 'and'.
comment:5
SergeyBiryukov — 21 months ago
- Component changed from General to Formatting
- Keywords has-patch added
- Milestone changed from Future Release to 3.3
Related: #10823
comment:6
SergeyBiryukov — 21 months ago
- Keywords needs-refresh added
comment:7
SergeyBiryukov — 21 months ago
We already have __(' and ') string in .pot from wp_sprintf_l(), so we probably can use it here.
comment:8
SergeyBiryukov — 20 months ago
- Milestone changed from 3.3 to Future Release
How can I force to use the slash in the url? I want to use a slash in my post url, but when I save my custom slug in the post editor it gets stripped out. There should be

replaces slashes with hyphens in post title slugs and taxonomy term slugs; replaces ampersands with "and" and "&c" with "etc" in post title slugs