Home › Forums › General Issues › Why does add_field always clear the cache? › Reply To: Why does add_field always clear the cache?
This is very confusing. So here is what I am understanding is happening.
The register acf group function is called. As WP / ACF doesn’t know if this field has been registered before or if it has changed, for good measure it is deleting the field set stored in object cache. Then it creates all the field again for this page load.
This is madness. Object cache calls should never used to store data only used for a single page load. Persistent object caching is designed to keep data between user sessions. It the data is going to be created and deleted on the fly like this, a php / class level variable should used as it is none persistent.
At the moment, these pointless deleting of objects in cache are resulting in for about 13% of my page load, every page load.
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!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.