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
December 20, 2025 at 10:43 am
#56617
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;
}