Working on a function that uses three fields to automatically form a Post Title.
However, I’m noticing that on first save, it only records the $client.
When I hit Update Post, the $client, $location, and $service all work. At that point the Title, and Slug update with all three variables correctly.
Should my hooks be one after the other like that? Not sure what I’m missing here…
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.