Home › Forums › General Issues › Pre-selecting choices in a select2 field in the front-end. › Reply To: Pre-selecting choices in a select2 field in the front-end.
Is the front end field an ACF field or your own implementation of Select2?
If it was an ACF field this wouldn’t be an issue, so I’m assuming that it’s the latter.
You would need to get the values in the ACF field and add them to JavaScript loaded by the page to set the selections. I don’t have any examples of this. Basically you’l need to localize your JS to make the values available on the page and then use the values in the Select2 initialization. You’d have to figure out how to do this with Select2.
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.