diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 7d8c5ace6a..339e09986d 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -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'] ), '&' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index a81ef22484..9d50ddad74 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47168'; +$wp_version = '5.4-alpha-47169'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.