Home Forums Backend Issues (wp-admin) WP Query – Multiple values in ACF Checkbox Reply To: WP Query – Multiple values in ACF Checkbox

  • That sounds really interesting – great article, and thanks. I’m not advanced enough with PHP to be sure how you would tackle the part that cycles through the repeaters in your example for a checkbox field:

    if (have_rows('colors', $post_id)) {
     while (have_rows('colors', $post_id)) {
      $color = get_sub_field('color');
      if (isset($saved_values[$color])) {
      add_post_meta($post_id, $meta_key, $color, false);
      $saved_values[$color] = $color;  

    Presumably we can’t do if(have_rows()) and while(have_rows()) if there are no rows?

    I’m interested in doing this BEFORE the site I’m building gathers a lot of content, and learning something I can use again in future too. Would you mind showing me how you’d do this for a non-repeater?

    Thanks so much.