Home › Forums › General Issues › Show field value before update › Reply To: Show field value before update
I suspect the issue is with the logic you’re using in the template itself. Let’s say the field is called “enable_sidebar” and the options are “enable” & “disable”. Existing posts will not have any value stored for the field “enable_sidebar” until you re-save them, so you need to count the scenario of having no value as equivalent to “enable”.
Something like this should do it:
if (!get_field("enable_sidebar") || get_field("enable_sidebar") == "enable") {
//sidebar here
}
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.