I’ve been trying to sort first page products with true/false field. As it is true the product is supposed to appear on first page. I used this meta_query to show all products
‘meta_query’ => array(
‘relation’ => ‘OR’,
array(
‘key’ => ‘show_on_first_page’,
‘compare’ => ‘EXISTS’,
),
array(
‘key’ => ‘show_on_first_page’,
‘compare’ => ‘NOT EXISTS’,
)
),
This mixes up all the products but if acf true/false field has been checked once it shows the products in the right order. Is there a way to set acf true/false field to be false globally on default if it is set to NULL?
Where
key=field_60ca0457d6821update to the key of the true/false field in your case.This will need adding to functions.php.