Support

Account

Home Forums Add-ons Repeater Field Adding more rows to repeater field programatically Reply To: Adding more rows to repeater field programatically

  • Fixed! This was a dumb mistake! Removed [] from $value

    if ( is_user_logged_in() ) {
    
        $user_id = get_current_user_id();
        $field_key = 'field_5bdc8d3c953f2';
        $value = get_field($field_key, 'user_'.$user_id);
        $new_row = array('name' => $dogsname, 'sex' => $sex, 'rda' => $rda);
        array_unshift( $value, $new_row  );
        update_field($field_key, $value, 'user_'.$user_id);
    
    }