Notice: Trying to access array offset on value of type bool in
I got this for each loop:
foreach($ids as $id){
if (stripos($field['name'], 'label_') !== FALSE) {
echo '';
}
else{
$val = get_field_object($field['name'], $id);
echo '<td>'.generate_view($field['name'], $val['value']).'</td>';
}
}
The error is saying this line is incorrect:
echo '<td>'.generate_view($field['name'], $val['value']).'</td>';
This error just came for the first time and I realy need to fix it but I don’t know what it is saying and how to solve. Anyone can help me out?
I searched and found other posts regarding this issue on Stackoverflow but can’t figure out to translate the answers in order to fix my problem:(
2
Answers
check if $val is null echo ”;
Adapted with the due, readable checks. Feel free to shorten or modify it.