Home › Forums › Backend Issues (wp-admin) › update_field is not working in action hook › Reply To: update_field is not working in action hook
the situation:
i have a custom post type where fields are created using php (not acf gui). one of the fields, a readonly text area, is supposed to be populated after users save draft then click publish.
the actual code:
created a function that do some string generation using while loop. at the last line of the function, update_field the text area. it hooked into draft_to_publish action with priority 10 (tried 5 and 20, same issue)
the problem:
all codes in the function are run without error (this is tested and verified) but the field is not updated.
the test:
we copied all codes inside the function to a page template, link it with that particular content, visit the permalink to execute the code. it runs fine and updated the textarea field
hope that’s more clear on the problem
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.