Ok how do I find the categories of this posts?
Basically I am using the plugin: https://www.ads-software.com/plugins/user-submitted-posts/
In the form you can insert a tag; this tag is attached to a post.
I am using the following and it works but if i duplicate the code below and I change the cat id in order to have all the tags within various categopries where the tags are used, it repeats the same tags for all categories.
<?php
$cat=5;
$yourcat = get_category($cat);
if ($yourcat) {
echo '<h3>' . $yourcat->name . '</h3>';
}
$args = array(
'categories'=> '5'
);
$tags = get_category_tags($args);
$content .= "<ul>";
foreach ($tags as $tag) {
$content .= "<li><a href=\"$tag->tag_link\">$tag->tag_name</a></li>";
}
$content .= "</ul>";
echo $content;
?>