Support

Account

Home Forums General Issues Convert JS serialized post-edit form data to get_fields array Reply To: Convert JS serialized post-edit form data to get_fields array

  • When you submit a form with ACF fields on it ACF reads through the $_POST[‘acf’] input recursively. It does not convert anything. This is just to give you an idea of what’s going on, this is not exact, just pseudocode.

    
    function recursive_function($array) {
      // not really the function name
      foreach ($array as $key => $value) {
        if (is_array($value)) {
          // recurse
          recursive_function($value);
        } else {
          // update field value
        }
      }
    }
    

    Obviously there is a whole lot more going. ACF looks up the field key to find the field type and the recursive calls are done by field types that allow sub fields and the data for each field is formatted correctly for each field type before updating.

    You would need to build a similar process.