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
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've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.