Home › Forums › ACF PRO › get_field('field')['subfield'] vs get_field('field_subfield') › Reply To: get_field('field')['subfield'] vs get_field('field_subfield')
A group field can have more calls to the DB or the same number. This depends on if the values for the sub fields are already in the WP meta cache. Usually they are, but there are conditions where they are not. Each sub field of a group field is stored separately in the database.
In the normal course of actions WP runs setup_postdata on the current post and all meta fields retrieved in a single query and stored in the cache.
When getting values for a post that does not already have its meta fields stored then there is one db query for the group field and an additional db query for each sub field.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.