How can I change the below code to display only the selected terms in the node. right now all terms which are defined in the vocabulary is displayed
<?php
$items = taxonomy_vocabulary_machine_name_load('test_categories');
$taxonomy = taxonomy_get_tree($items->vid);
foreach($taxonomy as $key => $items):
print $items->name;
endforeach;
?>