admin管理员组文章数量:1290975
i have a url like this:
www.url.ui/?keyone=valueone&keytwo=valuetwo&ekythree=valuethree
stored in a variable:
$url = www.url.ui/?keyone=valueone&keytwo=valuetwo&keythree=valuethree
I use wp_redirect( $url )
to redirect to the url, but the problem is that after the redirect the url in the browser looks like this:
www.url.ui/?keyone=valueone&keytwo=valuetwo&keythree=valuethree
This is how a create the url above:
$param = keyone=valueone&keytwo=valuetwo&keythree=valuethree
$url .= '?' . $param;
So function itself looks like this:
function redirect(){
$url = www.url.ui/;
$param = keyone=valueone&keytwo=valuetwo&keythree=valuethree
$url .= '?' . $param;
wp_redirect( $url )
}
So the function itself works fine, but the redirected url does not look like expected.
I already tried wp_sanatize_redirect()
and the php function urlencode
but neither of them results in what i need.
i have a url like this:
www.url.ui/?keyone=valueone&keytwo=valuetwo&ekythree=valuethree
stored in a variable:
$url = www.url.ui/?keyone=valueone&keytwo=valuetwo&keythree=valuethree
I use wp_redirect( $url )
to redirect to the url, but the problem is that after the redirect the url in the browser looks like this:
www.url.ui/?keyone=valueone&keytwo=valuetwo&keythree=valuethree
This is how a create the url above:
$param = keyone=valueone&keytwo=valuetwo&keythree=valuethree
$url .= '?' . $param;
So function itself looks like this:
function redirect(){
$url = www.url.ui/;
$param = keyone=valueone&keytwo=valuetwo&keythree=valuethree
$url .= '?' . $param;
wp_redirect( $url )
}
So the function itself works fine, but the redirected url does not look like expected.
I already tried wp_sanatize_redirect()
and the php function urlencode
but neither of them results in what i need.
1 Answer
Reset to default 1Nothing I see in Core would do that in either wp_redirect()
or wp_sanitize_redirect()
(which is used by wp_redirect()
). However...
- both functions are pluggable and so could have been replaced by theme or plugin code.
- And
wp_redirect()
has thewp_redirect
filter that can be used to alter the redirect location-- the part you are having trouble with. Something could be causing trouble.
I don't know how to guess at which of those two are the problem.
本文标签: wp queryWp redirect to url with ampersand string
版权声明:本文标题:wp query - Wp redirect to url with ampersand string 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741507193a2382391.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
esc_url_raw()
before using it for redirection. – cybmeta Commented May 29, 2015 at 4:58