Hello,
Simplifying, I have a page that does
if ($_GET('id')) {
...
update repeater
...
}
read repeater
if $_GET(‘id’) is defined the read does not return the updated repeater. I am sure that the code inside the if is executed correctly because in the admin side I see that the data has indeed changed.
What should I do so that the read returns the latest data? Is there some kind of repeater cache?
Thank you
This could be an issue with the cache if you are getting the values of the field before you are updating them and then trying to get the updated fields. I’ve been looking but I can’t see how to clear the ACF cache.
Are you reading the values before you updated them? What is the reason for doing this?
This reply has been marked as private.
At one time I knew how to clear the ACF cache and force the values to be reloaded, but ACF has changed the way it does this and looking at the code I’m don’t really understand it, and they have no documentation on it.
I would more than likely find a way to store the values in an array during the update and then use those values.
I don’t know if this will help you, but
while (have_rows('repeater')) {
$row = the_row();
}
it is a little known fact that the_row()
returns the current row, unformatted, as an array of field_key => value pairs.