Home › Forums › General Issues › API Functions Not Working Properly › Reply To: API Functions Not Working Properly
Ok so here’s the deal from the top. I have a large amount of static pages 11,000+ on each one there is a function that is supposed to save a few random reference numbers in ACF fields which will be used to pull data from the database.
There’s a bunch more to it but it’s not particularly relevant because even the basic stuff is not working properly.
For the purpose of fixing this problem let’s say I have 2 function on the page only, which is basically the case at this point.
update_field('reference_number', 92); $number = get_field('reference_number'); echo $number;
when I initially load one of the pages it will display correctly 92. If I immediately refresh the page the 92 goes away as if the field no longer exists, and I can never get it back. Also if I change the update_field() to enter a different number it will never change the number after that initial page load including if I check the actual entry in the postmeta table in the database.
Additionally everything is there and looks correct when I check the postmeta table in the database.
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.