nctions%2Fadd_query_arg%2F%3Freplytocom%3D263%23feedback-
editor-263)

  6. Skip to note 13 content 

[ rlabrovi ](https://profiles.wordpress.org/gardelin/) [ 3 years ago
](https://developer.wordpress.org/reference/functions/add_query_arg/#comment-4789)

[ You must log in to vote on the helpfulness of this note
](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_query_arg%2F%23comment-4789
"You must log in to vote on the helpfulness of this note") Vote results for
this note:  -1  [ You must log in to vote on the helpfulness of this note
](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_query_arg%2F%23comment-4789
"You must log in to vote on the helpfulness of this note")

If query string value is ending with ` == ` one ` = ` is stripped out.

    
        add_query_arg( array( 'something' => 'blabla==' ), 'https://www.google.com' );

Result will be  
` https://www.google.com?something=blabla= `  
but should be  
` https://www.google.com?something=blabla== `

[ Log in to add feedback
](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_query_arg%2F%3Freplytocom%3D4789%23feedback-
editor-4789)

  7. Skip to note 14 content 

[ janw.oostendorp ](https://profiles.wordpress.org/janwoostendorp/) [ 8 years
ago
](https://developer.wordpress.org/reference/functions/add_query_arg/#comment-1057)

[ You must log in to vote on the helpfulness of this note
](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_query_arg%2F%23comment-1057
"You must log in to vote on the helpfulness of this note") Vote results for
this note:  -4  [ You must log in to vote on the helpfulness of this note
](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_query_arg%2F%23comment-1057
"You must log in to vote on the helpfulness of this note")

A way to get the current total url using ` add_query_arg `

    
        home_url( add_query_arg( null, null ));

     * This does not work if WordPress has been installed in a subfolder and siteurl contains a subfolder like ` https://domain.com/subfolder ` In your example, this would repeat the arguments like ` https://domain.com/subfolder/subfolder ` Correct code would be home_url( add_query_arg( null, null, null )); Or even better just use ` network_site_url() ` instead. 

[ Rene Hermenau ](https://profiles.wordpress.org/renehermi/) [ 5 years ago
](https://developer.wordpress.org/reference/functions/add_query_arg/#comment-3066)

     * Another way to get the current url is: 
        
                $current_path = add_query_arg(array());

This is equivalent to setting ` $key ` and ` $value ` parameters to ` null ` ,
and not providing a ` $url ` parameter. Thus, it returns the current url,
having appended nothing to it.

[ SherylHohman ](https://profiles.wordpress.org/sherylhohman/) [ 5 years ago
](https://developer.wordpress.org/reference/functions/add_query_arg/#comment-3226)

     * This will not work if WordPress is installed to a sub-directory. Both [ home_url() ](https://developer.wordpress.org/reference/functions/home_url/) and [ add_query_arg() ](https://developer.wordpress.org/reference/functions/add_query_arg/) return the directory. I think this would be better: ` '//' . $_SERVER['HTTP_HOST'] . add_query_arg( null, null ) `

[ mjulian7 ](https://profiles.wordpress.org/mjulian7/) [ 5 years ago
](https://developer.wordpress.org/reference/functions/add_query_arg/#comment-3297)

     * Another way: ` $current_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; `

[ alvarofranz ](https://profiles.wordpress.org/alvarofranz/) [ 1 year ago
](https://developer.wordpress.org/reference/functions/add_query_arg/#comment-6194)

[ Log in to add feedback
](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpr