troubleshooting Question

How to get the value of an ACF Checkbox?

Avatar of ClintonK
ClintonKFlag for United Kingdom of Great Britain and Northern Ireland asked on
7 Comments1 Solution2097 ViewsLast Modified:
I've got a Custom Post called you "youtube" which has three ACF custom fields, one of which is a Checkbox (color)  that can have three values;

red : Red
green : Green
blue : Blue

I've created a post array using this code:
      $youtube_ids = get_posts(
            'post_type'      => 'youtube',
            'post_status'    => 'publish',
            'posts_per_page' => - 1,
            'fields'         => 'ids',
      ) );

For each post I want to see if a certain checkbox value has been set.
Something along the lines of this pseudo code:

foreach youtube_ids value
 if Color == red
    do some html stuff
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros