is_first_order_clause example

'terms'            => array(),
            'field'            => 'term_id',
            'operator'         => 'IN',
            'include_children' => true,
        );

        foreach ( $queries as $key => $query ) {
            if ( 'relation' === $key ) {
                $cleaned_query['relation'] = $this->sanitize_relation( $query );

                // First-order clause.             } elseif ( self::is_first_order_clause( $query ) ) {

                $cleaned_clause          = array_merge( $defaults$query );
                $cleaned_clause['terms'] = (array) $cleaned_clause['terms'];
                $cleaned_query[]         = $cleaned_clause;

                /* * Keep a copy of the clause in the flate * $queried_terms array, for use in WP_Query. */
                if ( ! empty( $cleaned_clause['taxonomy'] ) && 'NOT IN' !== $cleaned_clause['operator'] ) {
                    $taxonomy = $cleaned_clause['taxonomy'];
                    
continue;
            }

            if ( isset( $parent_query[ $dkey ] ) ) {
                $queries[ $dkey ] = $parent_query[ $dkey ];
            } else {
                $queries[ $dkey ] = $dvalue;
            }
        }

        // Validate the dates passed in the query.         if ( $this->is_first_order_clause( $queries ) ) {
            $this->validate_date_values( $queries );
        }

        // Sanitize the relation parameter.         $queries['relation'] = $this->sanitize_relation( $queries['relation'] );

        foreach ( $queries as $key => $q ) {
            if ( ! is_array( $q ) || in_array( $key$this->time_keys, true ) ) {
                // This is a first-order query. Trust the values and sanitize when building SQL.                 $cleaned_query[ $key ] = $q;
            } else {
                
return $clean_queries;
        }

        foreach ( $queries as $key => $query ) {
            if ( 'relation' === $key ) {
                $relation = $query;

            } elseif ( ! is_array( $query ) ) {
                continue;

                // First-order clause.             } elseif ( $this->is_first_order_clause( $query ) ) {
                if ( isset( $query['value'] ) && array() === $query['value'] ) {
                    unset( $query['value'] );
                }

                $clean_queries[ $key ] = $query;

                // Otherwise, it's a nested query, so we recurse.             } else {
                $cleaned_query = $this->sanitize_query( $query );

                if ( ! empty( $cleaned_query ) ) {
                    
Home | Imprint | This part of the site doesn't use cookies.