Home › Forums › ACF PRO › How to add custom class to admin_body_class based on ACF field data? › Reply To: How to add custom class to admin_body_class based on ACF field data?
You are correct that
get_field() will not automatically work because you are on the admin side, however, it is possible to pass the post_id you want the value from as a parameter:
There is however still an issue with that global post. Especially on post creation this might not work properly and another issue is that you could only see results by saving your changes and then refreshing the page.
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!