Small improvements in the filtering by attribute lookup table.

- Use 'absint' instead of an '(int)' in an anonymous function.
This commit is contained in:
Nestor Soriano 2021-06-08 15:47:04 +02:00
parent 0b1158cf5c
commit ef9145de86
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
1 changed files with 1 additions and 6 deletions

View File

@ -74,12 +74,7 @@ class Filterer {
$all_terms = get_terms( $taxonomy, array( 'hide_empty' => false ) );
$term_ids_by_slug = wp_list_pluck( $all_terms, 'term_id', 'slug' );
$term_ids_to_filter_by = array_values( array_intersect_key( $term_ids_by_slug, array_flip( $data['terms'] ) ) );
$term_ids_to_filter_by = array_map(
function( $id ) {
return (int) $id;
},
$term_ids_to_filter_by
);
$term_ids_to_filter_by = array_map( 'absint', $term_ids_to_filter_by );
$term_ids_to_filter_by_list = '(' . join( ',', $term_ids_to_filter_by ) . ')';
$is_and_query = 'and' === $data['query_type'];