Home › Forums › ACF PRO › get_field('field')['subfield'] vs get_field('field_subfield') › Reply To: get_field('field')['subfield'] vs get_field('field_subfield')
get_field('field')['subfield'];
calls
get_field('field');
so ACF gets the entire group field as an array
get_field('field')['subfield'];
is simply returning one element of that returned array. So yes, this could create extra work if you do not want to get the entire group and all of its sub fields.
Basically what you are doing is a shortcut for
$array = get_field('group_field');
value = $array['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!
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.