help to fix php error: strlen() expects parameter 1 to be string, array given
-
My goal is for $related to be used if any of the sub_fields are populated.
$topic_tags = get_sub_field('topic_related_tags'); $topic_post = get_sub_field('related_post'); $topic_page = get_sub_field('related_page'); $related = (strlen($topic_tags) + strlen($topic_post) + strlen($topic_page ) >0)?true:false;
Using
$related = (isset($topic_tags) && isset($topic_post) && isset($topic_page ))?true:false;
results as true even if there aren’t any sub_fields.But using (strlen()) gives an error where the title will go.
“Warning: strlen() expects parameter 1 to be string, array given…”obviously I’m not a php coder but I have exhausted my google skills trying to figure it out.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘help to fix php error: strlen() expects parameter 1 to be string, array given’ is closed to new replies.