Home › Forums › General Issues › Issues with getting field in functions.php › Reply To: Issues with getting field in functions.php
The global $post value will not be valid on the init
hook. You can’t use this until after this global is set up inside of the loop. The earliest hook you may be able to use would probably bewp
https://codex.wordpress.org/Plugin_API/Action_Reference. You may also need to use https://codex.wordpress.org/Function_Reference/get_queried_object to get the post and ID since I’m pretty sure that $post still won’t have a value outside of “The Loop”
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.