Open wpsumo opened 3 years ago
Hi @wpsumo
Thanks for the topic. We'll be more than happy to investigate this with you.
Firstly, is it possible you are also using an Local JSON field definitions in your theme? It's possible this could be causing a conflict, but unlikely. Please let me know so we can rule this out as a variable to the issue.
It's odd that the Fields appear when editing a Field Group, but not when editing a Post. This is a valuable clue to the issue, but I'm yet sure what it means.
When editing a Post (or any other WP object), ACF will first load the Field Groups for that screen via the acf_get_field_groups()
function. With the Field Groups in hand, ACF can then load the fields for each group using acf_get_fields()
which in turn calls acf_get_raw_fields()
. This is the function where I believe a caching issue could occur as ACF us using the wp_cache_get()
function to find any previously found fields for the given "parent" value.
Each time a field is created or updated, it will call the acf_flush_field_cache()
function which clears all the cached data for that field, and also the cached data used by acf_get_raw_fields()
. This is being achieved with the wp_cache_delete()
function.
In theory, ACF should be fully compatibly with all caching plugins. If possible, can you relay this information to the WordPress.org ticket you have created, and perhaps perform some debugging through these mentioned functions to better understand why the cache is not being flushed as expected?
@elliotcondon Thanks!
Yes using Local JSON
It's odd that the Fields appear when editing a Field Group, but not when editing a Post. This is a valuable clue to the issue, but I'm yet sure what it means.
The problem is the other way around as once I save a new created field it disapears as it's not in the redis and object cache.
Never had issues before, but can't say once it started to happened. But it is conneted to ACF or redis plugin or redis instance on the server. Let's rule out as your suggestions is based on the missunderstand of the other way around while the issue only appears in edit field group page and once creating new fields. I guess something there is cached and doesn't trigger a flush of the isolated part once saving and adding a new field.
Hi @wpsumo
Thanks for the clarification. You are indeed correct that I had miss interpreted the problem - which is the other way around.
Good to know you are using Local JSON. I suspect this the reason why your Fields are appearing when editing a Post. If you temporarily rename the "acf-json" folder or simply delete the JSON files, does the issue become more widespread?
My response and suggestions still remain. When editing a Field Group, the same "flush" functions will be run when saving fields. I recommend that you debug these functions to better understand why the Redis cache is not behaving as expected.
First posted in the wordpress support forum for the redis object cache plugin https://wordpress.org/plugins/redis-cache/
https://wordpress.org/support/topic/acf-field-group-issues/#post-14001057
Having problems where redis is keeping the cache of ACF Field Group page. New entered fields doesn’t show up in the edit and admin screen. They do show up in the user interface but not in admin control of the Field Group page. Previous entries are stuck and hold in cache. It shows up as soon as I clear the redis cache from the plugin or disable this plugin.
Plugin author refer the issue to be within ACF.