Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 24,013
- How-to & Troubleshooting
- 129,617
- Creating & Extending
- 25,789
- Requests & Feedback
- 9,497
- Third Party Plugins
- 9,791
- Showcase
- 3,316
- Ideas
- 1,384
- Miscellaneous
- 9,175
-
This works to remove doubles from a URL:
$string = "http://website.com/blogname/blogname/page/2/";
$string = preg_replace("/([,.?!])/"," \\1",$string);
$parts = explode("/",$string);
$unique = array_unique($parts);
$unique = implode("/",$unique);
$unique = preg_replace("/\s([,.?!])/","\\1",$unique);
echo $unique;
This outputs:
http://website.com/blogname/page/2
Now I have to turn it into a function…