0

I've been aware about the difference of wp_query and query_posts. I just want to know what impact does both query methods to the performance of the page? Which query method makes the page load quicker or slower?

  • See my answer in the duplicate. I wrote an extensive answer on this – Pieter Goosen Feb 19 '16 at 7:24
  • 2
    Also, you have to read my answer here – Pieter Goosen Feb 19 '16 at 7:26
  • Hi, you again @pieter. you've been helping me a lot. Well, i just don't understand one thing, Should i use get_posts or wp_query for maximizing load performance? – karlo jay bueno Feb 19 '16 at 7:33
  • get_posts are meant for non paginated queries as it breaks pagination (legally). That is why it is faster than a normal WP_Query. If you look at the source of get_posts, this is achieved by passing 'no_found_rows' => true to WP_Query. So to answer your comment, if you need a non paginated query, use get_posts or WP_Query, but then remember to pass 'no_found_rows' => true as an argument to WP_Query. The effect will be the same. For paginated queries, never use get_posts, use WP_query – Pieter Goosen Feb 19 '16 at 7:41
  • Ok, That's great to know. Thank you again, @pieter. So if i use get_posts to fetch an image url for the post's banner, it will be faster than using wp_query? and also, does get_posts uses the same arguments as wp_query? – karlo jay bueno Feb 19 '16 at 7:48
-2

The question was answered a few times on this site. Have a look at this answer

|improve this answer|||||
  • 2
    Please mark the question as duplicate. Do not post links as answers – Pieter Goosen Feb 19 '16 at 7:22

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