Home › Forums › Front-end Issues › Most efficient way to access ACF properties when listing posts? › Reply To: Most efficient way to access ACF properties when listing posts?
The first time that you call the_field(), all of the custom field data for the post should be retrieved from the database and stored in the WP cache. Subsequent calls the the_field() get values from this cache. At least that’s the way it’s supposed to work.
You can test this by installing this plugin https://wordpress.org/plugins/query-monitor/
load your page and see how many queries are done. Then add this directly before your calls the_field();
$meta = get_post_meta();
This specifically tells WP to get all custom fields for a post. When you load your page again there should be no difference in the number of queries.
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.