Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
redirect canonical
// tack on any additional query vars
$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'] );
}
$_parsed_query = rawurlencode_deep( $_parsed_query );
$redirect_url = add_query_arg( $_parsed_query, $redirect_url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.