Skip to content

Commit

Permalink
Make sure $query_object is in fact an object (it could be null)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Feb 28, 2024
1 parent 94a8f08 commit b3d8ab5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/classes/Elasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,12 @@ public function query( $index, $type, $query, $query_args, $query_object = null
*/
do_action( 'ep_retrieve_aggregations', $response['aggregations'], $query, '', $query_args );

if ( method_exists( $query_object, 'set' ) ) {
$query_object->set( 'ep_aggregations', $response['aggregations'] );
} else {
$query_object->query_vars['ep_aggregations'] = $response['aggregations'];
if ( is_object( $query_object ) ) {
if ( method_exists( $query_object, 'set' ) ) {
$query_object->set( 'ep_aggregations', $response['aggregations'] );
} else {
$query_object->query_vars['ep_aggregations'] = $response['aggregations'];
}
}
}

Expand Down

0 comments on commit b3d8ab5

Please sign in to comment.