Home Forums Add-ons Repeater Field Update empty Repeater Field


Update empty Repeater Field

  • Hello,

    I am trying to „update“ an empty repeater field on a programmatically created (custom) post. Unfortunately, if I want to watch the post afterwards, PHP it runs in a memory limit error. If don’t add any rows to the repeater while creating the post, add some rows from the backend GUI and change it programmatically afterwards: Everything works fine.

    The Rows-Array I add is exactly as the Rows-Array I get, when I add it through the backend.

    This is the code I use to add the rows:

    // medien
                    $files = get_field('medien', $post);
                    $files = array();
                    foreach($queryArray['files'] as $file) {
                        if(trim($file) != '') {
                            $files[] = array(
                                'medium'        => (int)$file,
                                'freigegeben'   => 0
                    if(count($files) > 0) {
                        update_field('medien', $files, $post);

    I tried both lines to get the “blank” array. The $queryArray[‘files’]-Array is List with File-IDs.

    Thanks for your help! 🙂

  • Hi @cemderin,

    Thanks for the post.

    The issue might be with the count() function, with your logic, the update_field() function is set to run to infinity since count will implement continuously and you have not set a break point.

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

The topic ‘Update empty Repeater Field’ is closed to new replies.