Make WordPress Core


Ignore:
Timestamp:
01/06/2022 06:12:33 PM (3 years ago)
Author:
desrosj
Message:

Grouped backports to the 5.1 branch.

  • Query: Improve sanitization within WP_Tax_Query.
  • Query: Improve sanitization within WP_Meta_Query.
  • Upgrade/Install: Avoid using unserialize() unnecessarily.
  • Formatting: Correctly encode ASCII characters in post slugs.

Merges [52454-52457] to the 5.1 branch.
Props vortfu, dd32, ehtis, zieladam, whyisjake, xknown, peterwilsoncc, desrosj, iandunn.

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/src/wp-includes/class-wp-tax-query.php

    r43571 r52472  
    527527            // The sibling must both have compatible operator to share its alias.
    528528            if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators ) ) {
    529                 $alias = $sibling['alias'];
     529                $alias = preg_replace( '/\W/', '_', $sibling['alias'] );
    530530                break;
    531531            }
     
    556556        }
    557557
    558         $query['terms'] = array_unique( (array) $query['terms'] );
     558        if ( 'slug' === $query['field'] || 'name' === $query['field'] ) {
     559            $query['terms'] = array_unique( (array) $query['terms'] );
     560        } else {
     561            $query['terms'] = wp_parse_id_list( $query['terms'] );
     562        }
    559563
    560564        if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) {
Note: See TracChangeset for help on using the changeset viewer.