Title: WP_Query on tag.php
Last modified: August 31, 2016

---

# WP_Query on tag.php

 *  Resolved [jonwatson87](https://wordpress.org/support/users/jonwatson87/)
 * (@jonwatson87)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/wp_query-on-tagphp/)
 * I’m probably being dense, but I can’t seem to figure out what the issue here 
   is.
 * The site I’m developing uses a custom loop, with a query that excludes any posts
   ticked as archived.
 * The reason I want to edit the tag.php template is to output custom meta to the
   front end, and tweak the appearance of all posts on the archive pages.
 * It works perfectly for the majority of the site, but on tag.php it causes to 
   tag cloud to break, making any and every tag clicked bring up the full post list.
 * When I remove the query the tag cloud works fine, but archived posts are still
   displayed and aren’t laid out the way they need to be.
 * The query code I’m using is:
 *     ```
       // The Queries
            $args = array(
       	'post_type' => array('post', 'report', 'analysis', 'guest-blog'),
       	'order'     => 'DESC',
       	'meta_query'     => array(
       		array(
       		'key'     => 'epi_pubarchive',
       		'value'   => 1,
       		'compare' => '!=',
       		)
       	)
            );
   
            $the_query = new WP_Query( $args );
       ```
   
 * The meta key, epi_pubarchive, is a checkbox created using Meta Box, essentially
   checking if the box is ticked or not.
 * I’ve tried removing the meta_query and trying it with the basic post_type and
   order args, but that won’t work either.
 * Anyone know what the issue with tags and queries is?
 * Is there a better way to achieve the desired result?

The topic ‘WP_Query on tag.php’ is closed to new replies.

## Tags

 * [custom loop](https://wordpress.org/support/topic-tag/custom-loop/)
 * [tag.php](https://wordpress.org/support/topic-tag/tag-php/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [jonwatson87](https://wordpress.org/support/users/jonwatson87/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/wp_query-on-tagphp/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
