Title: Attachment Tags
Last modified: August 19, 2016

---

# Attachment Tags

 *  [Brian Kimball](https://wordpress.org/support/users/brian-kimball/)
 * (@brian-kimball)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/attachment-tags/)
 * Hi all,
 * I have added post_tags to my attachments and that is all working fine. The problem
   is when I click the tag it goes to the correct URL but it does not show the attachments
   associated with the tag. Do I need to filter the loop like one would do with 
   a custom post type (pre_get_posts) or do I need to write some kind of query in
   my loop-tag.php? Can anybody help?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Brian Kimball](https://wordpress.org/support/users/brian-kimball/)
 * (@brian-kimball)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/attachment-tags/#post-2055449)
 * I still haven’t figured this out. Basically I want to show a loop of attachments
   that are tagged by that term. Any help is appreciated.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [15 years, 1 month ago](https://wordpress.org/support/topic/attachment-tags/#post-2055450)
 * That’s because the tag look looks for POSTS specifically. If you look in your
   DB, you’ll see the ‘type’ field has different values: post, page, revision, attachment,
   etc etc. The loop looks just for posts.
 * You would have to rebuild the loop to scan for attachments: [http://wordpress.org/support/topic/referring-to-an-attachment-file-in-the-loop?replies=3](http://wordpress.org/support/topic/referring-to-an-attachment-file-in-the-loop?replies=3)
 * And even then I’m not sure how much you’d have to re-invent to get tags working
   right.
 *  Thread Starter [Brian Kimball](https://wordpress.org/support/users/brian-kimball/)
 * (@brian-kimball)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/attachment-tags/#post-2055455)
 * Thanks for the response Ipstenu. I understand that the query looks for the post
   by default. I can also get it to display attachments and attachments by terms
   but I would have to right a query for each specific term. I know there is a way
   to tell the query to treat the attachments as posts I just don’t know how to 
   make it generate a list of attachments according to the term. Thanks again
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [15 years, 1 month ago](https://wordpress.org/support/topic/attachment-tags/#post-2055461)
 * Like I said, you’ve got some re-invention going on. 🙁 You will need to build
   your own query that pulls the attachments (see the link I posted? It does that).
   In theory you would need to write an SQL call to use the post-ID from that query
   to summon the postmeta table and pull in the tags.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Attachment Tags’ is closed to new replies.

## Tags

 * [attachment post type](https://wordpress.org/support/topic-tag/attachment-post-type/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 4 replies
 * 2 participants
 * Last reply from: [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/attachment-tags/#post-2055461)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
