Allow empty uris to be passed to add_query_arg(). Useful when appending arguments to WP_Query query strings that do not yet have any arguments.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-11-21 06:03:19 +00:00
parent 2201be3af3
commit 368bf570e6
1 changed files with 6 additions and 4 deletions

View File

@ -2348,11 +2348,13 @@ function add_query_arg() {
$uri = @func_get_arg(1); $uri = @func_get_arg(1);
} }
else { else {
$uri = @func_get_arg(2); if (@func_num_args() < 3) {
} $uri = $_SERVER['REQUEST_URI'];
if ('' == $uri) { } else {
$uri = $_SERVER['REQUEST_URI']; $uri = @func_get_arg(2);
}
} }
if (strstr($uri, '?')) { if (strstr($uri, '?')) {
$parts = explode('?', $uri, 2); $parts = explode('?', $uri, 2);
if (1 == count($parts)) { if (1 == count($parts)) {