Skip to content

Commit

Permalink
Fixed meta_query to check for relation
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Jun 21, 2024
1 parent ac508ab commit 7283ecc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions includes/class-crp.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,13 @@ public function prepare_query_args( $args = array() ) {
*/
$meta_query = apply_filters( 'crp_query_meta_query', $meta_query, $args ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query

// Add a relation key if more than one $meta_query.
if ( count( $meta_query ) > 1 ) {
// Validate meta_query structure.
if ( ! is_array( $meta_query ) ) {
$meta_query = array();
}

// Add a relation key if more than one $meta_query and if 'relation' is not already set.
if ( count( $meta_query ) > 1 && ! isset( $meta_query['relation'] ) ) {
/**
* Filter the meta_query relation parameter.
*
Expand Down

0 comments on commit 7283ecc

Please sign in to comment.