Title: Question about query_posts
Last modified: August 20, 2016

---

# Question about query_posts

 *  [jiming](https://wordpress.org/support/users/jiming/)
 * (@jiming)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/question-about-query_posts/)
 * Hello!
 * I would like to exclude category from the loop and I have some question:
 *     ```
       <?php if ( is_home() ) {
       			query_posts($query_string . '&cat=-124');
       			}
       		?>
               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
               	<?php get_template_part( 'content', get_post_format() ); ?>
               <?php endwhile; else: ?>
                   <p><?php _e('empty'); ?></p>
               <?php endif; ?>
       ```
   
 * A guy told me I have to use global $post, posts instead of $query_string, whats
   the difference? I read in the codex I have to run wp_reset_query(); after i “
   finished”? Why? And where have to put that code? (wp_reset_query();)
 * Thank you very much!

The topic ‘Question about query_posts’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [jiming](https://wordpress.org/support/users/jiming/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/question-about-query_posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
