Title: get_posts() versus query_posts() confusing
Last modified: August 18, 2016

---

# get_posts() versus query_posts() confusing

 *  [saltlakejohn](https://wordpress.org/support/users/saltlakejohn/)
 * (@saltlakejohn)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/get_posts-versus-query_posts-confusing/)
 * The difference between get_posts() and query_posts() confuses me. Under what 
   circumstances would I use one in preference to the other?
 * Do both of them extract a subset of ALL posts into an array that can be passed
   into another Loop?

Viewing 1 replies (of 1 total)

 *  [dcstrad](https://wordpress.org/support/users/dcstrad/)
 * (@dcstrad)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/get_posts-versus-query_posts-confusing/#post-510509)
 * > Do both of them extract a subset of ALL posts into an array that can be passed
   > into another Loop?
 * Yes. However, with query_posts() you don’t need to use the setup_postdata() function,
   while with get_posts() you do. The other thing I have noticed is that after using
   query_posts(), the is_archive() conditional tag returns TRUE. So if you’re going
   to use the conditional tags (is_single(), is_page(), is_archive(), etc.), do 
   not use query_posts().

Viewing 1 replies (of 1 total)

The topic ‘get_posts() versus query_posts() confusing’ is closed to new replies.

## Tags

 * [best practices](https://wordpress.org/support/topic-tag/best-practices/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [query](https://wordpress.org/support/topic-tag/query/)

 * 1 reply
 * 2 participants
 * Last reply from: [dcstrad](https://wordpress.org/support/users/dcstrad/)
 * Last activity: [18 years, 6 months ago](https://wordpress.org/support/topic/get_posts-versus-query_posts-confusing/#post-510509)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
