Home › Forums › Backend Issues (wp-admin) › Get field key via script › Reply To: Get field key via script
I’ve also been looking for a way to get the key from a name. The best solution I’ve come up with is adding a function which does a switch/case on the field name and applies a filter to return the key. However, it does require that you manually code a case/return/break for each field (probably not practical if you’ve got more than a few dozen fields).
Code here: https://gist.github.com/wells5609/5971010
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.