#41718 closed defect (bug) (duplicate)
A "/" character in a post title should become a "-" in its permalink
Reported by: | pressupinc | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Permalinks | Keywords: | |
Focuses: | Cc: |
Description
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.
Duplicate of #10792.