Forums
-
- Forum
- Posts
-
- Installing BuddyPress
- 24,005
- How-to & Troubleshooting
- 129,527
- Creating & Extending
- 25,790
- Requests & Feedback
- 9,496
- Third Party Plugins
- 9,782
- Showcase
- 3,316
- Ideas
- 1,397
- Miscellaneous
- 9,170
-
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…
See also: WordPress.org • bbPress.org • BuddyPress.org • Matt • Blog RSS