title: Why I'm getting only one post with get_posts in WordPress?
body: <p><strong>UPDATE: I now know why didn't worked. It was because I was trying to show a private post. Dumm me. Happens to the best of us. Sorry. And thanks for all your help.</strong></p>
  
  <p>I'm trying to list all posts with certain meta key and meta value but I can't get all the posts with that certain meta value. I'm only getting one.</p>
  
  <p>I have a foreach loop and the next code to list all my posts like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>$args = array( 
          'post_type' =&gt; 'produs', 
          'meta_key' =&gt; 'sticky_post', 
          'meta_value' =&gt; 1
  ); 
  $posts = get_posts($args);
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>          &lt;?php
         foreach($posts as $post){ ?&gt;
                                  &lt;div class="product" id="product-&lt;?php echo $post-&gt;ID; ?&gt;"&gt;
                                      &lt;div class="thumb new_product_thumb"&gt;
                                      &lt;?php 
  
                                          $thumb_args = array('class' =&gt; 'product-img', 'alt' =&gt; the_title_attribute( 'echo=0' ) ); 
  
                                          ?&gt;
  
                                      &lt;a class="product-thumb read-more" style="" href="&lt;?php echo the_permalink(); ?&gt;" title="citește mai departe"&gt;
  
                                          &lt;?php echo the_post_thumbnail('product-listing', $thumb_args); ?&gt;
  
                                      &lt;/a&gt;
                                       &lt;?php  //if ( current_user_can('manage_options') ) {
                                                  if (get_field('tva_produs',$post-&gt;ID) == '9') echo '&lt;div class="tva_redus"&gt;&lt;/div&gt;';
                                                  // var_dump($top_sellers_new);
                                              //}
                                       ?&gt;
                                      &lt;/div&gt;
                                      &lt;h2&gt;
  
                                          &lt;a class="read-more" style="" href="&lt;?php echo the_permalink(); ?&gt;" title="citește mai departe"&gt;
  
                                              &lt;?php the_title(); ?&gt;
  
                                          &lt;/a&gt;
  
                                      &lt;/h2&gt;
  
                                      &lt;div class="product-content"&gt;
  
                                          Pret: &lt;?php echo get_field('pret_nou', $post-&gt;ID); ?&gt; lei
  
                                      &lt;/div&gt;
  
                                      &lt;a class="read-more more2" href="&lt;?php echo the_permalink(); ?&gt;" title="citește mai departe"&gt;&lt;p&gt;Detalii produs&lt;/p&gt; &lt;span class="arrow-next"&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;
  
                                      &lt;?php $id = get_the_ID();?&gt;
  
                                      &lt;form id="adauga_in_cos" action="&lt;?php echo THEME_URL; ?&gt;/product.php?action=add&amp;product=&lt;?php echo $id; ?&gt;" method="post"&gt;
  
                                          &lt;input type="hidden" name="produs_id" id="produs_id" value="&lt;?php echo $id; ?&gt;" /&gt;
  
                                          &lt;input type="hidden" name="produs_price" id="produs_price" value="&lt;?php echo get_field( 'pret_nou', $id ) ?&gt;" /&gt;
  
                                          &lt;input type="hidden" name="produs_name" id="produs_name" value="&lt;?php echo $post-&gt;post_title; ?&gt;" /&gt;
  
                                          &lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title_attribute(); ?&gt;" class="add_to_sc" id="add-&lt;?php echo $id; ?&gt;"&gt;&lt;/a&gt;
  
                                      &lt;!-- &lt;input id="adauga_but" class="add_to_sc" type="submit" value="Adauga in cos" /&gt;--&gt;
  
                                      &lt;/form&gt;
  
                                      &lt;div class="horizontal"&gt;&lt;/div&gt;
  
                                  &lt;/div&gt;
  
                           &lt;?php } ?&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Why do I get only one post with meta_value 1, instead of all with meta_value 1 ?</p>