From 368bf570e6e688947e49b2b934fd228269cea262 Mon Sep 17 00:00:00 2001 From: rboren Date: Sun, 21 Nov 2004 06:03:19 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 93fe485c19..341af830c3 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2348,11 +2348,13 @@ function add_query_arg() { $uri = @func_get_arg(1); } else { - $uri = @func_get_arg(2); - } - if ('' == $uri) { - $uri = $_SERVER['REQUEST_URI']; + if (@func_num_args() < 3) { + $uri = $_SERVER['REQUEST_URI']; + } else { + $uri = @func_get_arg(2); + } } + if (strstr($uri, '?')) { $parts = explode('?', $uri, 2); if (1 == count($parts)) {