Home Forums Front-end Issues Query posts by checkbox value NOT IN Array Reply To: Query posts by checkbox value NOT IN Array

  • There is no solution just using ACF. If you want to store the value in the standard WP format then what you’ll need to do is create another custom field that is not part of ACF and when a values is saved to then update the value in the other field. For example:

    // priority of 20 to run after acf has updated value
    add_action('acf/save_post', 'convert_my_checkbox_to_standard', 20);
    function convert_my_checkbox_to_standard($post_id) {
      $values = get_field('my_check_box_field', $post_id);
      delete_post_meta($post_id, 'my_converted_checkbox_field');
      if (!count($value)) {
        // no values, bail early
      foreach ($values as $value) {
        add_post_meta($post_id, 'my_converted_checkbox_field', $value, false);

    With this in place you can then do your searches based on the converted field rather than the ACF field.

    If you’re interested I have created an entire plugin that’s designed for converting values in ACF fields to make them easier to use in queries