Do not add URL query args twice in certain Canonical Redirect situations. Use add_query_arg(). props filosofo. fixes #15774

git-svn-id: https://develop.svn.wordpress.org/trunk@17030 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2010-12-17 20:23:34 +00:00
parent 4c684ff252
commit 381f8eeed1
1 changed files with 2 additions and 5 deletions

View File

@ -234,11 +234,8 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
// tack on any additional query vars // tack on any additional query vars
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
if ( $redirect_url && !empty($redirect['query']) ) { if ( $redirect_url && !empty($redirect['query']) ) {
if ( strpos($redirect_url, '?') !== false ) parse_str( $redirect['query'], $_parsed_query );
$redirect_url .= '&'; $redirect_url = add_query_arg( $_parsed_query, $redirect_url );
else
$redirect_url .= '?';
$redirect_url .= $redirect['query'];
} }
if ( $redirect_url ) if ( $redirect_url )