Hi, I’m writing a custom script and need to get a field’s value in a callback function on the wp_insert_post_data hook, which is fired before the field is saved using the Save Draft button in the event edit view. For some reason, I am unable to get and ACF custom field using $_POST[] when on an Event edit page. Any help would be appreciated.
Thank you for your debugging recommendation ! I found the problem.
ACF does not use the field name in html forms. The field name is only available when the meta field is saved. Instead, they use this structure : [‘acf’][‘field_xxxxxxxxxx’] where we need to pass the field key as the second identifier. So it is possible to get the form field using $value = $_POST['acf']['field_xxxxxxxxxx'];
Cheers !
Patrick
Viewing 2 reply threads
The support post ‘$_POST[] not returning ACF field value on Event edit page’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.