title: Create ACF repeater field from front end
body: <p>I'm trying to create a form users can use to post from the front end of a wordpress site.</p>
  
  <p>I'm having trouble with creating repeater fields though. I've tried a couple of methods, but nothing seems to work:</p>
  
  <pre><code>$periods = $_POST['periods'];
  
      // for each perdiod, save the start/end date and notes
      for ($p = 1; $p &lt;= $periods; $p++) {
  
          update_sub_field( array('date', $p, 'start-date'), $_POST['p'.$p.'-start-date'] );
          update_sub_field( array('date', $p, 'end-date'), $_POST['p'.$p.'-start-date'] );
          update_sub_field( array('date', $p, 'notes'), $_POST['p'.$p.'-start-date'] );
  
      } // end periods loop
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    // for each perdiod, save the start/end date and notes
      for ($p = 1; $p &lt;= $periods; $p++) {
  
          add_post_meta($post_id, 'date_'.$p.'_start-date', $_POST['p'.$p.'-start-date']);
          add_post_meta($post_id, 'date_'.$p.'_end-date', $_POST['p'.$p.'-end-date']);
          add_post_meta($post_id, 'date_'.$p.'_notes', $_POST['p'.$p.'-notes']);
  
      } // end periods loop
  </code></pre>
  
  <p>But these do nothing to the post itself.</p>
  
  <p>The repeater is set up like this:</p>
  
  <p>Date (repeater) -> </p>
  
  <ul>
  <li><p>start-date (field)</p></li>
  <li><p>end-date (field)</p></li>
  <li><p>notes (field)</p></li>
  </ul>
  
  <p>There's also another repeater field in there (repeater within a repeater), but I want to get this one working first!</p>
  
  <p>Any ideas?</p>