[wp-trac] [WordPress Trac] #41718: A "/" character in a post title should become a "-" in its permalink
WordPress Trac
noreply at wordpress.org
Wed Aug 23 20:47:12 UTC 2017
#41718: A "/" character in a post title should become a "-" in its permalink
----------------------------+-----------------------------
Reporter: pressupinc | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
Recently wrote a post with a "/" in the title and was surprised to see the
words before and after the "/" combined in the permalink. So if I write a
post called "How to Enter/Exit a Burning Building," the permalink
''won't'' be:
example.com/how-to-enter-exit-a-burning-building
but rather:
example.com/how-to-enterexit-a-burning-building
The second is less intuitive than the first; it's not what the user would
expect. It's also worse for SEO - nobody's searching for "enterexit," but
people searching for "enter exit burning" would want to find my article.
We have a patch for this. It's just changing line 2012 in wp-
includes/formatting.php from:
{{{$title = str_replace('.', '-', $title);}}}
to:
{{{$title = str_replace( array( '.', '/' ), '-', $title);}}}
It would be simple to add other characters to the array as well. We gave
it a bit of thought and are on the fence about other characters, like ":",
but for "/" it seems pretty clear-cut.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41718>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list