WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/03/2020 12:12:22 AM (18 months ago)
Author:
SergeyBiryukov
Message:

Canonical: When removing trailing punctuation from query string arguments, match the whole query var name.

Props daveslaughter.
Fixes #49347.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/canonical.php

    r47122 r47169  
    486486    if ( ! empty( $redirect['query'] ) ) {
    487487        // Remove trailing spaces and end punctuation from certain terminating query string args.
    488         $redirect['query'] = preg_replace( "#((p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
     488        $redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
    489489
    490490        // Clean up empty query strings.
Note: See TracChangeset for help on using the changeset viewer.