• 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)
  • 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.