Home › Forums › ACF PRO › Uncheck checkbox programmatically › Reply To: Uncheck checkbox programmatically
Yes, you cannot do anything with ACF fields from the DB until after ACF saves the values and acf has not done so when the hook you are using runs, so this is returning the old value and not the updated value
if(get_field("send_newsletter",$postid)){
in order to do things base on acf fields you need to do one of two things
The first it to use the acf/save_post hook to run your code.
The second is to look in $_POST[‘acf’] to check field values.
See this for more information on both https://www.advancedcustomfields.com/resources/acf-save_post/
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.