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

Reply To: Setting up pre-filters for an index

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Setting up pre-filters for an index Reply To: Setting up pre-filters for an index

#56617
Ernest MarcinkoErnest Marcinko
Keymaster

Hi Seamus,

It depends on what is the exact value stored in the field. If it’s a boolean, or a conversion of boolean to string “true” or “false”, then your code will not work, as this check fails:

    
    // Check if the field exists and is truthy (1, "1", true, "yes", etc.)
    if ( !empty($available) && $available !== '0' && $available !== 0 ) {
        return $post;
    }

Assuming the value can be a boolean string, then try the one below, it covers all possible type coercions:

    
    if ( $available !== 'false' && $available ) {
        return $post;
    }