WordPress removing multiple dashes/hyphens breaks my permalinks
|Reported by:||colinwiseman||Owned by:|
Description (last modified by johnbillion)
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.