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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.