Good day!
I am trying to change the PHP version from 7.4 to 8.0 on my Wordpress but it breaks. With PHP debug I see that the error is located in my child theme (all my plugins are deactivated):
Unmatched ')' on line 1115
I run the code on php tester and I don't see any mistake... And I doubt unmatched parenthesis can be the real error, as it should show also in previous PHP versions. Does anybody have a hint to guide me? Thanks!
This is the source code of the function, in case it's useful
function getTermsOfPost($postId){
$metaStr="";
$term_list = wp_get_post_terms($postId, 'post_tag', array("fields" => "all"));
$i = 1;
$arr = array(
"elem1", "elem2", "elem3"
);
foreach($term_list as $termSingle){
if(in_array($termSingle->name, $arr)){
if($i == 1) {
$metaStr = $termSingle->name;
} else {
$metaStr .= ",<br/>".$termSingle->name;
}
$i++;
}
} //line 1115
return $metaStr;
}