I use this code below to retrieve all tags from a specific category. The code is working correctly, but only returns three tags in stead of all tags (I assigned six tags for this category). These three tags I assigned at (07/6/2016) but other three tags assigned at (01/1/2016). Does the problem return to archive?

if (have_posts()) { 
    while (have_posts()) {
        $custom_cattags = get_the_tags();
        if ($custom_cattags) {
           foreach($custom_cattags as $custom_cattag) {
              $tags_array[] = $custom_cattag->slug;
$tags_arrs = array_unique($tags_array);
echo print_r($tags_array);
  • Why don't you use get_terms for this? – cjbj Jun 19 '16 at 14:29
  • @cjbj I don't know how use get_terms function for retrieve all tags in specific category if you know help me – Shwan Namiq Jun 19 '16 at 15:54
  • Just to get things straight. You have a category called "technology". The posts in that category also have tags. And now you want a list of all the tags that are attached to all the posts in the technology category. Right? – cjbj Jun 19 '16 at 16:06
  • @cjbj yes, I want that you say – Shwan Namiq Jun 19 '16 at 16:13
  • 1
    what is your number under 'settings - reading - blog page show at most [] posts'? try to add a 'posts_per_page' parameter with -1 to your query. – Michael Jun 19 '16 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.