WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What are the differences between using WP_Query() and get_posts()? Which is better to use in what case and why?

share|improve this question
What @John P Bloch said. – MikeSchinkel Aug 26 '10 at 18:56
Here is similar question with very good answer: wordpress.stackexchange.com/questions/1753/… – Krzysiek Dróżdż Dec 16 '13 at 17:34
up vote 6 down vote accepted

Well, get_posts() actually instantiates a new WP_Query object, so if you're comfortable using WP_Query directly, don't even bother with get_posts(); get_posts will only return the results from the database, whereas WP_Query gives you the whole functionality of the class.

share|improve this answer

In addition to what John P Bloch says, you can modify the default WP_Query object (instead of creating an new instance) before it runs with it's class methods and an action hook, reducing the db calls you make.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.