@ Andy
I still have not been able to duplicate the error you are seeing. All that I’m certain at this point is that it seems to occur for you in AJAX requests (you might have noticed the error is present in the settings JSON file) and when AI1EC fetches its javascript.
Can you make a temporary change the the wp_list_pluck() function? change it from this:
function wp_list_pluck( $list, $field, $index_key = null ) {
if ( ! $index_key ) {
/*
* This is simple. Could at some point wrap array_column()
* if we knew we had an array of arrays.
*/
foreach ( $list as $key => $value ) {
if ( is_object( $value ) ) {
$list[ $key ] = $value->$field;
} else {
$list[ $key ] = $value[ $field ];
}
}
return $list;
}
/*
* When index_key is not set for a particular item, push the value
* to the end of the stack. This is how array_column() behaves.
*/
$newlist = array();
foreach ( $list as $value ) {
if ( is_object( $value ) ) {
if ( isset( $value->$index_key ) ) {
$newlist[ $value->$index_key ] = $value->$field;
} else {
$newlist[] = $value->$field;
}
} else {
if ( isset( $value[ $index_key ] ) ) {
$newlist[ $value[ $index_key ] ] = $value[ $field ];
} else {
$newlist[] = $value[ $field ];
}
}
}
return $newlist;
}
to this:
function wp_list_pluck( $list, $field, $index_key = null ) {
if ( ! $index_key ) {
/*
* This is simple. Could at some point wrap array_column()
* if we knew we had an array of arrays.
*/
foreach ( $list as $key => $value ) {
if ( is_object( $value ) ) {
$list[ $key ] = $value->$field;
} else {
$list[ $key ] = $value[ $field ];
}
}
return $list;
}
/*
* When index_key is not set for a particular item, push the value
* to the end of the stack. This is how array_column() behaves.
*/
$newlist = array();
foreach ( $list as $value ) {
if ( is_object( $value ) ) {
if ( isset( $value->$index_key ) ) {
$newlist[ $value->$index_key ] = $value->$field;
} else {
$newlist[] = $value->$field;
}
} else {
if ( isset( $value[ $index_key ] ) ) {
$newlist[ $value[ $index_key ] ] = $value[ $field ];
} else {
if( 'name' == $field && !isset( $value[ $field ] ) ){
echo wp_debug_backtrace_summary();
wp_die('');
}
$newlist[] = $value[ $field ];
}
}
}
return $newlist;
}
The difference is that I added the following to be fore line 3220:
if( 'term_id' == $field && !isset( $value[ $field ] ) ){
echo wp_debug_backtrace_summary();
wp_die('');
}
What does this do? The error is caused when wp_list_pluck() is called to with $field set to ‘name’ – but an element in the passed array does not contain that as a key. This checks for such a situation and then prints the trace: this indicates which function it was called by, and which function called that, and so on.
You should see a series of function/method names indicating the sequence in which the functions were called.
wp_die() kills the process so we don’t lose the trace with a page redirect or something.
You site may or may not continue to work after after this change. What is important is to get a copy of the output of wp_debug_backtrace_summary(). After you do, then the file can be changed back.
