Home › Forums › ACF PRO › Query posts by checkbox value (dynamically) › Reply To: Query posts by checkbox value (dynamically)
@John Huebner It most definitely works and I couldn’t find any other way.
I tried creating a simple Yes/No checkbox. I created a field type “Checkbox” and entered the choices “Yes” and “No”. This doesn’t make a single checkbox like you would think. It makes a “Yes” checkbox and a “No” checkbox. What I wanted was a checkbox where true = “Yes” and false = “No”. Instead, I have to uncheck “Yes” and check “No” to change the saved value. The values display correctly everywhere on my site, but filtering is a problem.
The values stored in the DB are ‘a:1:{i:0;s:3:”Yes”;}’ and ‘a:1:{i:0;s:2:”No”;}’.
I’m sure you can see why the compare ‘LIKE’ works with the value ‘Yes’.
In retrospect, I should have just used a radio button.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.