Home › Forums › General Issues › Form Processing Hook Chart › Reply To: Form Processing Hook Chart
I don’t know what order they all fire, but, for example, acf/init fires during the WP init action. This is probably the earliest of them all. For the rest, most of them are called during the WP action or filter of the same name, like admin enqueue scripts, admin_head.
During form processing, that is saving values, some of them will not be run at all, these include acf/prepare_field and acf/render_field. The first when is run before a field is rendered and the second is run to render the field. Since there’s no rendering of fields during the save process they would not be called.
acf/load_field, acf/load_value, acf/validate_value, acf/update_value are all run on each field where the documentation mentions them. I do not believe that acf/load_value is called at all during form processing, saving of a value. The only exception to this would be if you have added an acf/save_post filter and you’re getting the values of the fields for some reason.
acf/save_post is run after WP inserts or updates a post. This could also run after WP inserts or updates a term or user. This is also run when an options page is being saved, but since there is not WP object envolved here I wouldn’t be sure.
As for the rest of them, I don’t know for sure. But they all involve specific fields and would only run when those fields are needed. I do know that validate attachment runs before update_value and that validate_value runs before update_value, but this only happens if for some reason the form did not validate during the AJAX request. validate_value also runs on each field during the AJAX validation request when no values are saved.
Not sure this helped you at all or why you’re looking for the information. I have the vague cloud in my head of the order that things happen in WP and most of the actions/filters in ACF are tied to WP filters.
This looks interesting https://wordpress.stackexchange.com/questions/162862/how-to-get-wordpress-hook-run-sequence/162863.
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.