Title: Problem with tags / labels
Last modified: May 3, 2017

---

# Problem with tags / labels

 *  [aptest19](https://wordpress.org/support/users/aptest19/)
 * (@aptest19)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/problem-with-tags-labels/)
 * Hi.
 * I am developing my first wordpress theme and I have to say that I know very little
   of php (I know enough about html and css).
 * That said, my problem is the tags of the posts: when I click on any tag should
   be open a page where they are all posts that have the same label (tag), but I
   still see all posts, even those that don’t have the selected label.
 * I’m using the function <? php the_tags(); ?> inside de loop, the structure is
   like this:
 *     ```
       <aside>
   
       <h4>Tags</h4>
   
       <ul class=”tags”>
   
       <?php the_tags( ”, ‘&nbsp – &nbsp’, ” ); ?>
   
       </aside>
       ```
   
 * No problem so far, becose I can see the tags of each post.
 * Inside the other single.php (which I use as a page template to view posts belonging
   to a specific category) I insert a query to call the posts that have the same
   label (tag):
 *     ```
       <?php
   
       $args = array(
       ‘post_type’ => ‘post’,
       ‘tag’ => “ tag name ”);
   
       $query = new WP_Query($args);
   
       if ($query->have_posts()) : while($query->have_posts()) : $query->the_post();
   
       ?>
       ```
   
 * but it doesn’t work, I can’t see only posts with a specific label, I see all 
   posts.
 * I hope someone can help me.
 * Thank you

Viewing 1 replies (of 1 total)

 *  [codismo](https://wordpress.org/support/users/codismo/)
 * (@codismo)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/problem-with-tags-labels/#post-9104142)
 * The **tag** accepts the tag slug, not the tag name. So if for example the tag
   name is “some tag” the slug would be “some-tag”.
 *     ```
       $args = array(
           'post_type' => 'post',
           'tag' => 'some-tag'
       );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Problem with tags / labels’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [codismo](https://wordpress.org/support/users/codismo/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/problem-with-tags-labels/#post-9104142)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
