Published on Mar 29, 2020

How to query posts by True / False ACF field

Sridhar Katakam

In the most recent WordPress customization I worked on, the requirement was to show WooCommerce products of a specific product category that have a checkbox of a True / False type of custom field (using Advanced Custom Fields plugin) ticked.

This members-only tutorial shows how to write a custom WordPress query (can be placed in a Code Block if using Oxygen) to fetch posts of product post type belonging to sound term of product_cat taxonomy for which latest_equipment field have a value of true .

Screenshot of the field group for your reference:

PHP & HTML

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $499 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right