Home › Forums › ACF PRO › Avoid using a foreach() with update_field() › Reply To: Avoid using a foreach() with update_field()
No there isn’t. ACF uses use update_post_meta() or update_metadata(). Every update requires at least 2 db queries and sometimes 3. This means that it can take 4 to 6 queries to update a single ACF field.
WP does not supply any way to update more than a single meta value at a time in a single query.
There is a way, but it would require accessing the database directly and constructing the correct SQL query to do multiple updates or inserts to the correct table in a single query. You would also need to account for both the field value and the acf field reference value as well.
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.