Skip to content

Commit 17efac8

Browse files
committed
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
1 parent dcaa093 commit 17efac8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/wp-includes/class-wp-tax-query.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,11 @@ private function clean_query( &$query ) {
556556
return;
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'] ) {
562566
$this->transform_query( $query, 'term_id' );

0 commit comments

Comments
 (0)