I keep getting this error pop up and I’ve been trying to trace is back to the root but everything seems fine.
The full error looks like:
Warning: Illegal offset type in isset or empty in advanced-custom-fields-pro\includes\class-acf-data.php on line 94 and 110
The problem is that it’s testing against an array which turns out to be the value I need returned. If I run a debug backtrace on 110 when passed an array as the name I get it running through the following functions with the following arguments.
– get_field( ‘my_key’, ‘term_123’ )
—- My Function Call
– acf_maybe_get_field( ‘my_key’, ‘term_123’ )
—- \includes\api\api-template.php LN 27
– acf_get_meta_field( ‘my_key’, ‘term_123’ )
—- includes\api\api-template.php LN 177
This is where the trouble starts, from that point on the passed arguments is an array. So I jump into
acf_get_meta_field() and down the rabbit hole I go. I get all the way to
acf-value-functions.php LN 18 and here’s the input & output:
acf_get_reference gets passed my proper
$post_id ( ‘my_key’, ‘term_123’ ) and it hits
acf_get_metadata() with this info and returns the array. All of this seems right.
The calling function (acf_get_meta_field) expects a
$field_key in return though.
$field_key = acf_get_reference( $key, $post_id );
And what is returned is an array of values. The array of values then gets passed down to
acf_get_field() which as
$id. Then it hits the
$store->has() conditional and falls apart.
@param (int|string) $id The field ID, key or name.
I understand the issue is likely on my end of things but I’m having trouble determining _where_ that disconnect is happening and am reaching out here for insight. This field is a term field and the taxonomy exists on multiple post types with terms assigned to multiple posts of different types.
Any ideas, things I can try? I don’t mind adding breakpoints to the plugin as they won’t be permanent to try and figure out where the issue is rooted and fix it.
This probably has nothing to do with this problem, but i got the exact same error and this pops up as the first result when you look it up.
If you’re trying to get the values of a field that’s in a group, the way you’re supposed to do that is to call
get_field() on the group’s slug, not the nested fields. It will return an assoc. array with all the nested fields in it.
You must be logged in to reply to this topic.
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!
© 2022 Advanced Custom Fields.