[wp-hackers] Are there any implications about using wp_redirect( add_query_arg( '', '' ) )?

James DiGioia jamesorodig at gmail.com
Tue Feb 16 12:57:12 UTC 2016

add_query_args takes two or three parameters, depending on how you'd prefer
to use it. See here:

It's not automatically going to redirect using the current $_GET params;
you need to specify in the function args what those params are supposed to

On Tue, Feb 16, 2016 at 5:23 AM, Nikola Nikolov <nikolov.tmw at gmail.com>

> Hi there,
> I've found myself in situations where I want to reload the current URL with
> PHP - for instance after processing a $_POST request - and in some cases I
> would add a $_GET parameter to the URL(so add_query_arg() would be a
> perfect fit there), but in others I don't need to do that. I found out that
> I can use
> wp_redirect( esc_url_raw( add_query_arg( '', '' ) ) );
> exit;
> Used that way add_query_arg() seems to just give me a path and any $_GET
> parameters currently present(for instance I would get
> /product/my-product/). I'm escaping the URL with esc_url_raw(), but wanted
> to make sure there's nothing wrong with doing things that way.
> Any thoughts?
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list