Skip to content
Permalink
Browse files Browse the repository at this point in the history
Query: Improve sanitization within WP_Tax_Query.
Merges [52454] to the 5.8 branch.
Props dd32, xknown, peterwilsoncc, ehtis.

git-svn-id: https://develop.svn.wordpress.org/branches/5.8@52459 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Jan 6, 2022
1 parent dcaa093 commit 17efac8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wp-includes/class-wp-tax-query.php
Expand Up @@ -556,7 +556,11 @@ private function clean_query( &$query ) {
return;
}

$query['terms'] = array_unique( (array) $query['terms'] );
if ( 'slug' === $query['field'] || 'name' === $query['field'] ) {
$query['terms'] = array_unique( (array) $query['terms'] );
} else {
$query['terms'] = wp_parse_id_list( $query['terms'] );
}

if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) {
$this->transform_query( $query, 'term_id' );
Expand Down

0 comments on commit 17efac8

Please sign in to comment.