Category Name and Slug field need to be the same otherwise it breaks category pages

I can’t comment yet, but I can answer – I think your problem may be that you’ve declared your $terms variable twice in your code, within your loop:

<?php $terms = get_the_terms( $post->id, 'knowledgebase_types' );  ?>

and

<?php $terms = get_the_terms( $post->post_id, 'knowledgebase_topics' );?>

Though some more information about what result you are actually seeing could help too – does the “topic” div show up empty, or with errors?