Support

Account

Home Forums Add-ons Repeater Field How to improve performance on add_row() for repeater field Reply To: How to improve performance on add_row() for repeater field

  • Those are interesting numbers. Going to tell you that I don’ use add_row() and delete_row(). I’ve only every created a repeater that has a couple hundred entries once.

    Most of the time when I’m updating a repeater I update the entire repeater using update_field(). Basically I generate all the rows of the repeater.

    
    $repeater = array(
      // each nested array is a row
      array (
        // each row is made up of field_key value pairs
        'field_XXXXXXX' => 'field value',
        'field_YYYYYYY' => 'field value
      )
    );
    

    once the repeater and all rows are created I call update field on the repeater

    
    update_field('field_ZZZZZZZ', $repeater, $post_id);
    

    Not sure if this is something you can try or not.