if it was associated with a post, I would say to use get_post_meta($post_id), because this causes WP to get all the meta values for a post and cache them.
With options, ACF sets the autoload to “no” and there isn’t a filter to change this. If autoload was set to “yes” then all of the options would be cached by WP and not require additional queries, however, the options would be loaded on every page load rather than just on the pages that need them.
Like I said, ACF does not have a filter to alter the autoload value and after digging through WP core it appears that neither does WP. You may want to post something in feature requests about adding a way to alter autoload on ACF option page values.
As I said in my previous post, I would use some type of caching mechanism, perhaps set up my own transient cache for to store the results of the html fragment that’s being generated.
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!
© 2022 Advanced Custom Fields.