after I (git) commit my theme with the php acf export in it, acf values are disappearing from the front (they stay visible in the back office)
I have to go thrue the posts, and publish them again, in order to see the custom fields values in the front…
Any idea how to fix that ?
You say that the fields and values still exist in admin while not appearing in your theme. Could you do a check right after you encounter this to see wether the values actually exist in the wp_postmeta table for the posts affected.
apparently yes they’re still in the wp_postmeta table with the good post ID,
when I re-publish the post, you can see in the database that the missing values are added (the new values I added to the flexible field)
So maybe the field won’t be printed until all values are defined ? since i’ve added new values and I didn’t defined them in the back-office (they are not mandatory though…)
Thank you for your help
this still happens,
I have to republish the post, and everything is ok, but I’m afraid if I have more then 20 or 100 post, I won’t be really enjoying to re-publish everything ! and for production, this is not very nice 🙂
do you have any idea how to fix this or am I doing something wrong here, did you reproduce the bug ?
I’m not 100% I am completely understanding what you’re experiencing.
So you have a flexible field in which you’ve added new fields and those are not saving their values on the prod site when all fields are loaded through PHP?
=> dev : localhost – acf fields stored in php file
=> Prod : http url – updated with git, same configuration
=> I add acf fields to a group of field which are assigned to pages (flexible or not)
=> I update the php file with acf fields to do so
=> I commit to Production
some acf fields appears to be missing, like there is no value inside
But in the database, there are all values (except the new one I just added)
After result :
>> I update my page (without touching anything or filling the new acf fields)
>> The database updates and add the new acf values in wp_postmeta table (and only the new ones)
>> on page reload, the page is like before with all the fields
Hope it’s clear enough, I can help in any way, please let me know,
my mistake was to DUPLICATE fields :
as i had to quite similar group of fields, I duplicated them, therefore, name was the same but not the key,
it explains why I could see them in the Back Office but not in the Front…
You must be logged in to reply to this topic.
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!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.— Advanced Custom Fields (@wp_acf) February 23, 2023
© 2023 Advanced Custom Fields.