This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+16 -8
View File
@@ -77,18 +77,18 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
return;
}
// Notice fixing.
$original += array(
'host' => '',
'path' => '',
'query' => '',
'scheme' => '',
);
$redirect = $original;
$redirect_url = false;
$redirect_obj = false;
// Notice fixing.
if ( ! isset( $redirect['path'] ) ) {
$redirect['path'] = '';
}
if ( ! isset( $redirect['query'] ) ) {
$redirect['query'] = '';
}
/*
* If the original URL ended with non-breaking spaces, they were almost
* certainly inserted by accident. Let's remove them, so the reader doesn't
@@ -615,6 +615,14 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
unset( $redirect['port'] );
}
// Notice prevention after new parse_url( $redirect_url ) calls
$redirect += array(
'host' => '',
'path' => '',
'query' => '',
'scheme' => '',
);
// Trailing /index.php.
$redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] );