diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/class-wp-tax-query.php --- a/wp/wp-includes/class-wp-tax-query.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/class-wp-tax-query.php Tue Sep 27 16:37:53 2022 +0200 @@ -236,7 +236,7 @@ * * @param string $primary_table Database table where the object being filtered is stored (eg wp_users). * @param string $primary_id_column ID column for the filtered object in $primary_table. - * @return array { + * @return string[] { * Array containing JOIN and WHERE SQL clauses to append to the main query. * * @type string $join SQL fragment to append to the main JOIN clause. @@ -258,7 +258,7 @@ * * @since 4.1.0 * - * @return array { + * @return string[] { * Array containing JOIN and WHERE SQL clauses to append to the main query. * * @type string $join SQL fragment to append to the main JOIN clause. @@ -291,7 +291,7 @@ * @param array $query Query to parse (passed by reference). * @param int $depth Optional. Number of tree levels deep we currently are. * Used to calculate indentation. Default 0. - * @return array { + * @return string[] { * Array containing JOIN and WHERE SQL clauses to append to a single query array. * * @type string $join SQL fragment to append to the main JOIN clause. @@ -373,7 +373,7 @@ * * @param array $clause Query clause (passed by reference). * @param array $parent_query Parent query array. - * @return array { + * @return string[] { * Array containing JOIN and WHERE SQL clauses to append to a first-order query. * * @type string $join SQL fragment to append to the main JOIN clause. @@ -527,7 +527,7 @@ // The sibling must both have compatible operator to share its alias. if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators, true ) ) { - $alias = $sibling['alias']; + $alias = preg_replace( '/\W/', '_', $sibling['alias'] ); break; } } @@ -556,7 +556,11 @@ 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' ); @@ -633,6 +637,10 @@ break; } + if ( ! is_taxonomy_hierarchical( $query['taxonomy'] ) ) { + $args['number'] = count( $terms ); + } + $term_query = new WP_Term_Query(); $term_list = $term_query->query( $args );