Just replace your if statement with:
if
if(in_array($menu_item->post_title, ['twitter','linkedin'])) { $schema['sameAs'][] = $menu_item->url; }
1.4m articles
1.4m replys
5 comments
56.9k users