Home Forums Front-end Issues update_field values not showing on frontend


update_field values not showing on frontend

  • After couple of nights of searching and trying various approaches, I haven’t found any solution.


    I suspect that ACF’s cache is not clearing after saving programmatically post meta.

    I’m creating a tool for admins, which will update custom post type’s meta data (ACF-fields) with command update_field()

    Changes are being saved to the database and changes can be seen when editing the post. And actually the new values can be seen anywhere in backend.

    On the frontend new saved meta data can’t be seen, but there’s old values that doesn’t exist in the database anymore. In other words: on frontend meta data is showing value A, and in database is stored value B.

    So the values are not fetched from the database, but from cache, I think. If I update the post in the edit post view, then the new values will show on frontend. But instructing users to go editing post and save it after using this mentioned tool, is not good practice.

    So what am I not noticing?

    What have been tried

    This is what I have already tried: After update_field() I’ve run:


    These functions didn’t empty the cache. Am I perhaps using them wrong?

    I’m doing the developing in Local by Flywheel, which is using Nginx. I suspected about Nginx and switched to Apache, but that didn’t help. So Nginx isn’t causing the issue. And now as I’m developing the site, there is no cache plugins being used.

  • So no one else has experienced this problem?

  • When you use update_field() on a field that has not data it is not updated correctly if you use the field name. When calling update_field() for fields that were not previously set you must use the field key. update_field($field_key, $vale, $post_id)

    This is explained in the documentation

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.