Home Forums ACF PRO Multible checkbox selection in ACF does not work


Multible checkbox selection in ACF does not work

  • Hello,
    i have a problem (or maybe a bug?) with the ACF checkbox and the update_field function

    my values

    s1 : red
    s2 : blue
    s3 : green

    i want to select s1 and s2

    update_field( “eigenschaften_sicherheit”, array(“s2”, “s1”), 5268 );

    this code set only the latest s2 value and not the s1

    for exampe this code will only select s3

    update_field( “eigenschaften_sicherheit”, array(“s1”, “s3”), 5268 );

    The docs say this

    // save a checkbox or select value
    $field_key = “field_1234567”;
    $value = array(“red”, “blue”, “yellow”);
    update_field( $field_key, $value, $post_id );

    any ideas whats wrong with my code?

  • You’re using the field name, not the field key. To see the field key, when editing the field group, click on Screen Options (top right) and check the Field Keys option.

  • Thank you very much, works 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.