Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-key array after filtering before JSON encoding #105

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions class-es-wp-tax-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function get_dsl_for_query( &$query ) {
}

// Filter to remove empties.
$filters = array_filter( $filters );
$filters = array_values( array_filter( $filters ) );

if ( ! empty( $relation ) && 'or' === strtolower( $relation ) ) {
$relation = 'should';
Expand Down Expand Up @@ -321,7 +321,7 @@ public function transform_query( &$query, $resulting_field ) {
INNER JOIN $wpdb->terms USING (term_id)
WHERE taxonomy = '{$query['taxonomy']}'
AND $wpdb->terms.{$query['field']} IN ($terms)
"
"
);
break;
case 'term_taxonomy_id':
Expand All @@ -331,7 +331,7 @@ public function transform_query( &$query, $resulting_field ) {
SELECT $resulting_field
FROM $wpdb->term_taxonomy
WHERE term_taxonomy_id IN ($terms)
"
"
);
break;
default:
Expand All @@ -342,7 +342,7 @@ public function transform_query( &$query, $resulting_field ) {
FROM $wpdb->term_taxonomy
WHERE taxonomy = '{$query['taxonomy']}'
AND term_id IN ($terms)
"
"
);
}
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared, WordPress.VIP.DirectDatabaseQuery.NoCaching, WordPress.VIP.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery
Expand Down