Support

Account

Home Forums Add-ons Repeater Field Update one checkbox field inside a repeater

Solved

Update one checkbox field inside a repeater

  • Hello ACF-Community

    I want to update a checkbox field with 3 options inside a group inside a repeater with the update_row function, but it doesn´t work for me.

    The structure of my acf-fields ist

    ‘Repeater’
    -> ‘Group’
    -> ‘Checkbox’ => (‘Option1’, ‘Option2’, ‘Option3’)

    Maybe i have 5 entries in my repeater and want to add Option3 into the 4th entry.
    How does it works?

    I know the key of the checkbox field so i can address the field directly

    This is my code:
    update_row('field_63320fed32d79', 4, array('Checkbox' => 'Option3'), $post_id);

    The “Option3” will not be set after i used this code and i can´t find a solution for this specific case.
    There are a few answers for a update in a loop but no one for one row in a repeater with a someentries.

  • I found a solution

    I used the wrong field. The key was the the key from the checkbox field but i needed the key/name from the repeater field.

    update_row('repeater', 4, array('Group' => array('Checkbox' => 'Option3')), $post_id);

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

You must be logged in to reply to this topic.