mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Canonical: When removing trailing punctuation from query string arguments, match the whole query var name.
Props daveslaughter. Fixes #49347. git-svn-id: https://develop.svn.wordpress.org/trunk@47169 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -485,7 +485,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
|
||||
if ( ! empty( $redirect['query'] ) ) {
|
||||
// Remove trailing spaces and end punctuation from certain terminating query string args.
|
||||
$redirect['query'] = preg_replace( "#((p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
|
||||
$redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
|
||||
|
||||
// Clean up empty query strings.
|
||||
$redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' );
|
||||
|
||||
Reference in New Issue
Block a user