In my work on the ACF Custom Database Tables plugin, I write a lot of automated tests to ensure consistent handling as the plugin’s codebase evolves. A big part of this involves updating ACF fields using the update_field() function and then checking to make sure the data is stored in the database as expected and returned as it should when using get_field() to retrieve it.
Whilst most ACF field types have simple data structures, some are more complex and can take some figuring out to determine the correct structure.
Here’s an example of how I use PHP to update an ACF Google Map field programmatically when setting up the tests:
This site was created by Hookturn, the team behind ACF Theme Code Pro. If you are interested in contributing or have an extension to add, email us.
Awesome ACF is sponsored by the very awesome team at Pressidium. If you need reliable, secure and scalable Managed WordPress Hosting, check them out.