Home › Forums › Bug Reports › ACF Fields not caching with W3-Total-Cache › Reply To: ACF Fields not caching with W3-Total-Cache
Hi @james,
Thanks for the response! I’m actually planning on moving away from W3 Total Cache to using Redis (which has a properly implemented cache function), so that piece shouldn’t be too much of an issue for me.
However, there is the problem I’ve been running into with cache. In my code, I’m attempting to dynamically populate ACF Dropdown fields in the admin area, based on other post content. This is done using the filter ‘acf/load_field/name=field_name’. When caching isn’t working with W3 Total Cache, this runs fine. But when using a working cache it will run correctly once, cache those results, and then give me those same cached results for every post.
This also won’t work with the argument $db_only = true, because it returns before the filters run.
This problem could be solved by moving the filter calls above line 872 in api/api-field.php, and also moving them into line 848 in the same file. With the way it currently is, it will only ever run once, which is nice for most use cases, but doesn’t allow the same field to have different values on different posts with caching.
Is there a way around this?
Thanks!
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.