I have to retrieve all of the tags without duplicates from a custom tag list, so I followed the solution given at:
How to remove ducplicate tags from custom tag list?
I tried customizing the PHP code given in the solution as follows, only to get one tag ID returned by the foreach block:
if(is_category()):
$category = get_query_var('cat');
$categories = get_category($category);
endif;
$tagIDs = array();
query_posts('category_name='.$categories->slug);
if(have_posts()) : while(have_posts()) : the_post();
$tags = get_the_tags();
if($tags):
foreach($tags as $tag){
if(!in_array($tag->term_id, $tagIDs)):
$tagIDs[] = $tag->term_id;
$tagNames[$tag->term_id] = $tag->name;
endif;
}
endif;
endwhile; endif;
wp_reset_postdata();
echo '<ul>';
foreach($tagIDs as $tagID):
echo '<li><a href="'.get_tag_link($tagID).'">'.$tagNames[$tagID].'</a></li>';
endforeach;
echo '</ul>';
I have to retrieve all of the tag slugs without duplicates. How can I achieve that?
Changing the way paginate_links() was set up fixed this issue.