Home › Forums › Backend Issues (wp-admin) › Using 3 Fields to form a title fails on first publish. › Reply To: Using 3 Fields to form a title fails on first publish.
You should use a single
acf/save_post filter with a priority > 10.
The way you are doing it you are updating the post 3 times instead of once.
Also, with a priority of 10, your filters may or may not be running before ACF actually saves the values. When dealing with ACF you should almost always use a priority > 10 unless you actually want to do something before ACF saves values. If that’s the case then you should always use a priority of < 10.
I’m actually surprised that you’re not causing an infinite loop since this call
wp_update_post( $postdata ); should be triggering ACF to re-save the values and then call your function again.
You need to remove your filters before updating the post and read them after updating the posts.
remove_filter($hook, $callback, $priority); wp_update_post($postdata); add_filter($hook, $callback, $priority, $accepted_args);
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!
© 2022 Advanced Custom Fields.