[wp-trac] [WordPress Trac] #20399: WordPress removing multiple dashes/hyphens breaks my permalinks

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 9 20:01:11 UTC 2012


#20399: WordPress removing multiple dashes/hyphens breaks my permalinks
--------------------------+------------------------------
 Reporter:  colinwiseman  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.3.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Description changed by johnbillion:

Old description:

> Recently been trying to upgrade to WordPress 3.3.1 but a lot of our
> writers use characters like ~ and " in their titles, which am fine with
> as WordPress has always changed these to dashes.  So our URLs have
> multiple dashes/hyphens.
>
> I have tracked this down to line 892 of /wp-includes/formatting.php which
> is:
>
> $title = preg_replace('|-+|', '-', $title);
>
> and so it replaces more than 1 consecutive occurance of - with a single
> -.  And this is as the point the code checks the database.  Thus a URL
> e.g. "colin---wiseman---2012" gets changed to "colin-wiseman-2012" which
> is not a name of a post in the database.
>
> We cannot go back and change all our URLs as there are 1000s of pages and
> linked to from all around the internet.
>
> The only solution I have found is to comment out this line, but I'd
> rather there be an option in WordPress that I can flag in the wp-config
> e.g. define("SANATIZE_DASHES", false); so that the next time I upgrade
> wordpress there isn't this issue.
>
> I feel that until then, this is a serious bug that could be affecting
> more blogs than just mine.

New description:

 Recently been trying to upgrade to WordPress 3.3.1 but a lot of our
 writers use characters like ~ and " in their titles, which am fine with as
 WordPress has always changed these to dashes.  So our URLs have multiple
 dashes/hyphens.

 I have tracked this down to line 892 of /wp-includes/formatting.php which
 is:

 `$title = preg_replace('|-+|', '-', $title);`

 and so it replaces more than 1 consecutive occurance of - with a single -.
 And this is as the point the code checks the database.  Thus a URL e.g.
 "colin---wiseman---2012" gets changed to "colin-wiseman-2012" which is not
 a name of a post in the database.

 We cannot go back and change all our URLs as there are 1000s of pages and
 linked to from all around the internet.

 The only solution I have found is to comment out this line, but I'd rather
 there be an option in WordPress that I can flag in the wp-config e.g.
 define("SANATIZE_DASHES", false); so that the next time I upgrade
 wordpress there isn't this issue.

 I feel that until then, this is a serious bug that could be affecting more
 blogs than just mine.

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20399#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list