I’m using the following to populate terms on my pages…
$mget_site_url = get_site_url();
//This gets me all the correct terms...
$mget_the_terms = get_the_terms(get_queried_object_id(), 'ht_kb_tag');
echo __( 'Tagged: ', 'knowall' );
foreach ($mget_the_terms as $keygroup => $valuegroup) {
foreach ($valuegroup as $key => $value) {
if (($key == 'name') && ($value != 'layout-wide')) {
//link the terms
echo "<a href='{$mget_site_url}/tags/{$value}' rel='tag'>{$value}</a>";
}
}
}
How can I conditionally cancel this process if the page does not have any terms? Trying to avoid the foreach error I’m seeing.
Many thanks!