Title: Using Query posts on category page
Last modified: August 20, 2016

---

# Using Query posts on category page

 *  [mollycampbell14](https://wordpress.org/support/users/mollycampbell14/)
 * (@mollycampbell14)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/using-query-posts-on-category-page/)
 * I’m trying to limit the number of posts that show on a category page. I was doing
   this with query_posts, like this
 *     ```
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       		if (have_posts()){
       			query_posts('posts_per_page=6&paged=' . $paged);
       ```
   
 * The problem is that the query_posts seems to keep the site from realizing what
   category page it’s on, so it shows posts from all categories. Is there a way 
   to fix this? It seems like there should be a way to force WordPress to “get the
   category” after the query_posts so that it realizes what category it’s on and
   will then display only the relevant posts?
 * _Don’t duplicate topics_

The topic ‘Using Query posts on category page’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [mollycampbell14](https://wordpress.org/support/users/mollycampbell14/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/using-query-posts-on-category-page/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
