Home › Forums › General Issues › Access ACF functions from plugin › Reply To: Access ACF functions from plugin
OK, I answered my own question and I guess I was missing something really simple: just call get_field() from within my plugin code.
What I was missing was that because the get_field function is defined in a file that was “include”d by the ACF class initialize method, that function is added to the global namespace. It just never occurred to me that get_field might be a global function.
But I’m really confused about *why* the ACF coders would dump functions like “get_field” into the global namespace. If I ever attempt to load another plugin or theme that does the same thing – declares a ‘get_field’ function into the global namespace – it will trigger a fatal error.
Isn’t this what namespaces and classes are for?
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.