Leave a Reply

1 comment

  1. Actually, you’re a mistaken on a couple of points here.

    1. Don’t use query_posts()

    This function is meant for modifying an existing query, not performing a standalone query. You should either use get_posts() or a new instance of the WP_Query() class to perform your query for the custom loop.

    Here’s some further reading on query_posts():

    2. get_post_meta() doesn’t hit the DB repeatedly

    When you do run a post query, WordPress retrieves not only the post, but also the post meta. We use a built-in object cache to insulate the database from repeated requests for the same information. If you’re using a caching plugin on top of this, you can also receive the benefits of server-side tools like memcached.

    You can read about the object cache in the Codex. Take a close look at the list of persistent cache plugins at the bottom of the page, not only will they make get_post_meta() calls lighter, they’ll speed up other elements of the site as well.