Title: posts_per_page not working
Last modified: August 21, 2016

---

# posts_per_page not working

 *  [John](https://wordpress.org/support/users/groupewibi/)
 * (@groupewibi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/posts_per_page-not-working/)
 * Hi all,
 * I turning around since few days now, and i really do not undertand.
    I want to
   limit the number of post i displaying, but it seem not working at all.
 * My Query :
 *     ```
       $mesautresposts = new WP_Query(
       array(
       	'post_type' => 'post',
       	'posts_per_page'=> 10,
       	'order' => 'DESC',
       	'orderby' => 'date',
       	'post__not_in' => $do_not_duplicate,
       	'category__not_in' => $category_id,
       	'tax_query' => array(
             array(
               'taxonomy' => 'post_format',
               'field' => 'slug',
               'terms' => array( 'post-format-aside, post-format-video' ),
               'operator' => 'NOT IN'
       	      )
           ),
       	)
       );
       if($mesautresposts->have_posts()): var_dump($mesautresposts->request);
       echo '<p>Number of post :'.$mesautresposts->found_posts.'</p>';
   
       while($mesautresposts->have_posts()): $mesautresposts->the_post(); $do_not_duplicate[] = $post->ID; ?>
   
       <p><?php the_title(); ?></p>
   
       <?php endwhile; endif; wp_reset_postdata(); ?>
       ```
   
 * When i displaying the SQL query using ‘var_dump($mesautresposts->request);’ i
   have :
 * `SELECT SQL_CALC_FOUND_ROWS wp_2_posts.ID FROM wp_2_posts WHERE 1=1 AND wp_2_posts.
   ID NOT IN (5256,5262,5181,5119,5179,5124,4328,4316,4296,4287,5538,5159,5171,5156,4984)
   AND ( wp_2_posts.ID NOT IN ( SELECT object_id FROM wp_2_term_relationships WHERE
   term_taxonomy_id IN (193) ) ) AND wp_2_posts.post_type = 'post' AND (wp_2_posts.
   post_status = 'publish' OR wp_2_posts.post_status = 'private') AND ( wp_2_posts.
   ID NOT IN ( SELECT object_id FROM wp_2_term_relationships WHERE term_taxonomy_id
   IN (193) ) ) GROUP BY wp_2_posts.ID ORDER BY wp_2_posts.post_date DESC LIMIT 
   0, 10`
 * When i testing it directly in the database, all the results are ok, but when 
   i displaying it in the page, it’s not limiting the number of results.
 * Rather than having 10 post displayed, i have 22 posts displayed, and the found_posts
   is displaying 132 Posts !
 * I have look for filters and the pre_get_posts function in y template, and function.
   php, but nothing seem to modify the query.
 * Any idea from where it can come from ?

The topic ‘posts_per_page not working’ is closed to new replies.

## Tags

 * [posts_per_page](https://wordpress.org/support/topic-tag/posts_per_page/)
 * [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: [John](https://wordpress.org/support/users/groupewibi/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/posts_per_page-not-working/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
