This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Checkboxes AND logic

#20640
Ernest MarcinkoErnest Marcinko
Keymaster

Hi!

Well, there is no option there to change the logic, but with a custom code it might be possible. I will make sure to add a logic option for multi-select cases, it makes sense.

So, to resolve this, let’s try a custom code. Add this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter( 'asp_query_args', 'asp_and_logic_on_multiselect_cf', 10, 1 );
function asp_and_logic_on_multiselect_cf($args) {
    foreach ( $args['post_meta_filter'] as &$filter ) {
        if ( is_array($filter['value']) ) {
            $filter['logic'] = 'AND';
        }
    }
    return $args;
}