Query: Improve sanitization within WP_Tax_Query.

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

git-svn-id: https://develop.svn.wordpress.org/branches/5.9@52458 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2022-01-06 17:18:45 +00:00
parent 8a131093a3
commit abb893a104

View File

@ -556,7 +556,11 @@ class WP_Tax_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' );