Created
August 7, 2012 11:25
-
-
Save Ultrabenosaurus/3284643 to your computer and use it in GitHub Desktop.
A simple method to maintain current querystring when redirecting. Needed it for a WP plugin I'm making.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_join(){ | |
$keys = array_keys($_GET); | |
$url = '?'; | |
$first = true; | |
for($i = 0; $i < count($keys); $i++){ | |
if(!$first){ | |
$url .= '&'; | |
} | |
$url .= $keys[$i].'='.$_GET[$keys[$i]]; | |
$first = false; | |
} | |
return $url; | |
} |
I had no idea that function existed, I feel silly now :/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why bother with something this cumbersome and easily breakable?