Strip partial name= parameters when doing canonical redirection on them with default permalinks. props filosofo. fixes #15775

git-svn-id: http://svn.automattic.com/wordpress/trunk@17031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2010-12-17 20:57:03 +00:00
parent 213100d5ba
commit de0fc3026a
1 changed files with 9 additions and 0 deletions

View File

@ -235,6 +235,15 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
if ( $redirect_url && !empty($redirect['query']) ) {
parse_str( $redirect['query'], $_parsed_query );
$redirect = @parse_url($redirect_url);
if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
parse_str( $redirect['query'], $_parsed_redirect_query );
if ( empty( $_parsed_redirect_query['name'] ) )
unset( $_parsed_query['name'] );
}
$redirect_url = add_query_arg( $_parsed_query, $redirect_url );
}