WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#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.

Change History (2)

#1 @swissspidy
3 months ago

  • Component changed from General to Permalinks
  • Focuses administration removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version trunk deleted

Duplicate of #10792.

This ticket was mentioned in Slack in #core by pressupinc. View the logs.


3 months ago

Note: See TracTickets for help on using tickets.