mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Be more picky about the trailing blank query string things we strip. props filosofo, fitztrev, stevish, azaozz, DD32 (go team!). fixes #8098. fixes #8180
git-svn-id: http://svn.automattic.com/wordpress/trunk@9642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
41b43c1d03
commit
21eb85b469
@ -200,11 +200,14 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
||||
$redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );
|
||||
|
||||
if ( !empty( $redirect['query'] ) ) {
|
||||
// Remove trailing slashes from certain terminating query string args
|
||||
// Remove trailing spaces from certain terminating query string args
|
||||
$redirect['query'] = preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] );
|
||||
|
||||
// Clean up empty query strings
|
||||
$redirect['query'] = preg_replace( '#&?(p|page_id|cat|tag)=?$#', '', $redirect['query'] );
|
||||
$redirect['query'] = preg_replace( '#(^\??|&)(p|page_id|cat|tag)=?$#', '', $redirect['query'] );
|
||||
|
||||
// Remove redundant leading ampersands
|
||||
$redirect['query'] = preg_replace( '#^\??&+#', '', $redirect['query'] );
|
||||
}
|
||||
|
||||
// strip /index.php/ when we're not using PATHINFO permalinks
|
||||
|
Loading…
Reference in New Issue
Block a user