
The following pulls all category from a custom taxonomy that has a slug as ‘product-type’
function getcategoryname_forproduct($postid){
$categorys = get_the_terms($postid,'product-type');
foreach ($categorys as $category) {
$categor .= $category->name.', ';
}
return rtrim($categor, ', ');
}
The following pulls all categories a post belongs to default post
function getcategorynameallinpost($postid){
$categorys = get_the_category($postid);
foreach ($categorys as $category) {
$categor .= $category->name.', ';
}
return rtrim($categor, ', ');
}
Following Pulls all the tags (Custom Taxonomy in this case) of the post (custom post type in this case)