Title: Problem with query_posts
Last modified: August 20, 2016

---

# Problem with query_posts

 *  [grafx](https://wordpress.org/support/users/grafx/)
 * (@grafx)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/)
 * Hi,
 * I’ve got problems with query_posts in my index.php page on my personal template.
 * I want to display my personnal post type called “pub” (advert in french), my 
   categoryname : “accueil” (home), and who has the tag “carre”.
 * I’ve got 2 another loop before who dispay the 4 firsts posts, in all category,
   then the 4 firts posts another personal post type.
    That’s not working, this 
   is my code :
 *     ```
       <div id="publicite">
       <?php
       query_posts("post_type=pub&category_name=accueil&tag=carre");
       if (have_posts()) :
       while (have_posts()) : the_post();
       the_content();
       endwhile;
       endif;
       ?>
       </div>
       ```
   
 * Thanks a lot.

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

 *  Thread Starter [grafx](https://wordpress.org/support/users/grafx/)
 * (@grafx)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/#post-2409564)
 * No idea ?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/#post-2409570)
 * Try it with this:
 *     ```
       $args = array(
         'post_type' => 'pub',
         'tax_query' => array(
           'relation' => 'AND',
           array(
           	'taxonomy' => 'category',
           	'field' => 'slug',
           	'terms' => array( 'accueil')
           ),
           array(
           	'taxonomy' => 'post_tag',
           	'field' => 'slug',
           	'terms' => array('carre'),
           )
         )
       );
       query_posts($args);
       ```
   
 *  Thread Starter [grafx](https://wordpress.org/support/users/grafx/)
 * (@grafx)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/#post-2409598)
 * THANKS YOU !
 * Can you explain, or give me a link who explan that.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/#post-2409601)
 * [http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters](http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters)
   
   [http://ottopress.com/2010/wordpress-3-1-advanced-taxonomy-queries/](http://ottopress.com/2010/wordpress-3-1-advanced-taxonomy-queries/)
 *  Thread Starter [grafx](https://wordpress.org/support/users/grafx/)
 * (@grafx)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/#post-2409625)
 * You’re awesome dude.

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

The topic ‘Problem with query_posts’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [grafx](https://wordpress.org/support/users/grafx/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/problem-with-query_posts-3/#post-2409625)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
