Home › Forums › Bug Reports › acf_get_value notice incorrect › Reply To: acf_get_value notice incorrect
You yourself said that you are attempting to get a field value before init, this in my opinion is the reason for the error/warning you are seeing.
I don’t think I said that anywhere in this thread. I said the init is always performed and as you mentioned the documentation states you do not have to wrap the get_value in an init hook. Please open up the acf_maybe_get_field
function you will see the init
call.
The notice is just suppressed when you wrap all code in acf/init hook but the return value is still incorrect, it’s different when using the key to get the value. It would return 1
instead of true
in my case and this might cause unexpected side effects. This is a bug in my opinion. And if it works with a key without wrapping with an init hook it should also work with a name in my opinion, which technically is a simple fix and as a side effect improves performance for some users. Not sure why you would not want that.
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.