Query: Improve sanitization within WP_Tax_Query.

Merges [52454] to the 5.8 branch.
Props dd32, xknown, peterwilsoncc, ehtis.
Built from https://develop.svn.wordpress.org/branches/5.8@52459


git-svn-id: http://core.svn.wordpress.org/branches/5.8@52051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2022-01-06 17:22:00 +00:00
parent 266c585188
commit 6f7032dcf4

View File

@ -556,7 +556,11 @@ class WP_Tax_Query {
return;
}
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' );