Make WordPress Core


Ignore:
Timestamp:
01/06/2022 05:20:19 PM (2 years ago)
Author:
desrosj
Message:

Query: Improve sanitization within WP_Tax_Query.

Merges [52454] to the 5.8 branch.
Props dd32, xknown, peterwilsoncc, ehtis.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

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

    r48475 r52459  
    557557        }
    558558
    559         $query['terms'] = array_unique( (array) $query['terms'] );
     559        if ( 'slug' === $query['field'] || 'name' === $query['field'] ) {
     560            $query['terms'] = array_unique( (array) $query['terms'] );
     561        } else {
     562            $query['terms'] = wp_parse_id_list( $query['terms'] );
     563        }
    560564
    561565        if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) {
Note: See TracChangeset for help on using the changeset viewer.