Set Repeatable Section Row Count Using PHPPRO

The code below demonstrates how to set the row count of a repeatable section using PHP. In this example we also set the maximum row count to the same value.

<?php

  // Callback function for the wsf_pre_render_123 filter hook
  function my_pre_render_123( $form ) {

      // Set section ID
      $section_id = 321;

      // Set number of rows
      $row_count = 3;

      // Get section object
      $section = wsf_section_get_object( $form, $section_id );

      // Set default number of rows
      $section->meta->section_repeat_default = $row_count;

      // Set maximum number of rows
      $section->meta->section_repeat_max = $row_count;

      return $form_object;
  }

  // Add filter to change form ID 123 prior to rendering
  add_filter( 'wsf_pre_render_123', 'my_pre_render_123' );