title: Multiple Wordpress custom queries behaving oddly
body: <p>First off, here's the code :</p>
  
  <pre><code>    &lt;?php
      $categories = get_categories();
  
      foreach ($categories as $cat) { if ($cat-&gt;count &gt;= 4) { ?&gt;
      &lt;section class="home-section row"&gt;
          &lt;div class="large-12 columns"&gt;
              &lt;h3 class="ug-home-title"&gt;&lt;span&gt;&lt;?=$cat-&gt;name;?&gt;&lt;/span&gt;&lt;/h3&gt;
              &lt;div class="row"&gt;
                  &lt;div class="large-6 columns"&gt;
                      &lt;?php
                          $args = array(
                              'post_type' =&gt; 'post',
                              'category_name' =&gt; $cat-&gt;name,
                              'posts_per_page' =&gt; 1
                          );
                          $query = new WP_Query($args);
                          while ($query-&gt;have_posts()) : $query-&gt;the_post();
                      ?&gt;
                      &lt;article class="ug-panel"&gt;
                          &lt;ul class="ug-tag-list"&gt;
                              &lt;?php
                                  $post_categories = wp_get_post_categories( $post-&gt;ID );
                                  foreach ($post_categories as $c) {
                                      echo '&lt;li&gt;&lt;a href="'.get_category_link( get_cat_ID(get_category( $c )-&gt;name) ).'"&gt;'.get_category( $c )-&gt;name.'&lt;/a&gt;&lt;/li&gt;';
                                  }
                              ?&gt;
                          &lt;/ul&gt;
  
                          &lt;?php (has_post_thumbnail()) ? the_post_thumbnail() : displayBackupImage(); ?&gt;
  
                          &lt;footer class="ug-panel-inner"&gt;
                              &lt;p&gt;&lt;em&gt;&lt;?= 'il y a '.human_time_diff( get_the_time('U'), current_time('timestamp') ); ?&gt;&lt;/em&gt;&lt;/p&gt;
                              &lt;h4&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h4&gt;
                          &lt;/footer&gt;
                      &lt;/article&gt;
                      &lt;?php endwhile; wp_reset_postdata()?&gt;
                  &lt;/div&gt;
                  &lt;div class="large-6 columns"&gt;
                      &lt;ul class="ug-article-list"&gt;
                          &lt;?php
                              $args = array(
                                  'post_type' =&gt; 'post',
                                  'category_name' =&gt; $cat-&gt;name,
                                  'posts_per_page' =&gt; 3,
                                  'offset' =&gt; 1
                              );
                              $query = new WP_Query($args);
                              while ($query-&gt;have_posts()) : $query-&gt;the_post();
                          ?&gt;
                          &lt;li&gt;
                              &lt;article class="clearfix"&gt;
                                  &lt;a href="&lt;?php echo get_permalink(); ?&gt;" class="left picture"&gt;
                                      &lt;?php (has_post_thumbnail()) ? the_post_thumbnail() : displayBackupImage(); ?&gt;
                                  &lt;/a&gt;
                                  &lt;h5&gt;&lt;a href="&lt;?php echo get_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;br&gt;&lt;small&gt;publié il y a &lt;em&gt;&lt;?= human_time_diff( get_the_time('U'), current_time('timestamp') ); ?&gt;&lt;/em&gt;&lt;/small&gt;&lt;/h5&gt;
                              &lt;/article&gt;
                          &lt;/li&gt;
                          &lt;?php endwhile; wp_reset_postdata();?&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/section&gt;
      &lt;hr class="home-hr"&gt;            
      &lt;?php }} ?&gt;
  </code></pre>
  
  <p>As you can see, there is first a simple foreach loop for the categories containing more than 4 posts. Then, I am using two different custom queries to display those posts in two different places in my code.</p>
  
  <p>This works perfectly, but for some reason, it will invariably fail on some categories despite them containing posts, and I have no idea why. I've attached a screenshot so you can see the output.</p>
  
  <p>Any answer is greatly appreciated.</p>
  
  <p><strong>EDIT:</strong> it would seem to happen when a post belongs to two categories at the same time... A conflict maybe? I really am at a loss here.</p>
  
  <p><strong>EDIT 2:</strong> nope, it has nothing to do with that, some categories display the same post twice just fine...</p>
  
  <p><img src="https://i.stack.imgur.com/culpw.jpg" alt="The screenshot"></p>