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

Nikola Nikolov nikolov.tmw at gmail.com
Tue Feb 16 10:23:44 UTC 2016

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( '', '' ) ) );

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?

More information about the wp-hackers mailing list