Title: Posts_per_page work not correct
Last modified: August 19, 2016

---

# Posts_per_page work not correct

 *  [Deniska](https://wordpress.org/support/users/deniska/)
 * (@deniska)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/posts_per_page-work-not-correct/)
 * I have 2 category (parent and child) with one template for both. I want to use
   query_posts for pagination. I’m use posts_per_page for limit posts on page. All
   work’s fine except one things – **I cant see child category without parent**.
   If I dont use query_posts all works fine but I cant limit posts on page.
 * My code before loop.
 *     ```
       <?php
           $limit = 6;
           $catid = 4,6;
           $catid = strpos( $catid , ',' ) ? explode( ',' , $catid ) : array( (int) $catid );
           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
           query_posts(array('category__in'=>$catid,'posts_per_page'=>$limit,'paged'=>$paged));
           $wp_query->is_archive = true; $wp_query->is_home = false;
           ?>
       ```
   
 * Please help me understand!

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/posts_per_page-work-not-correct/#post-1460646)
 * > To display posts from either category 2 OR 6, you could use cat as mentioned
   > above, or by using category__in (note this does not show posts from any children
   > of these categories):
   > query_posts(array(‘category__in’ => array(2,6)));
 * [http://codex.wordpress.org/Function_Reference/query_posts#Category_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Category_Parameters)
 *  Thread Starter [Deniska](https://wordpress.org/support/users/deniska/)
 * (@deniska)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/posts_per_page-work-not-correct/#post-1460652)
 * Thank you for answer. I’m try to use all method that I know but they doesn’t 
   work.
    I try this
 *     ```
       <?php
           $limit = 6;
           $catid = 4,6;
           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
           query_posts('showposts=' . $limit . '&paged=' . $paged . '&cat=' . $catid);
           $wp_query->is_archive = true; $wp_query->is_home = false;
           ?>
       ```
   
 * Page show all posts and doesnt show only one category.

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

The topic ‘Posts_per_page work not correct’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Deniska](https://wordpress.org/support/users/deniska/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/posts_per_page-work-not-correct/#post-1460652)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
