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

git-svn-id: http://svn.automattic.com/wordpress/trunk@17030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2010-12-17 20:23:34 +00:00
parent 86daabffdf
commit 213100d5ba
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 )