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

There's no mention of custom fields values in Get_post's codex page. Is it impossible to use get_post to get a custom field value of some post, and if so, is it necessary to perform a whole loop just for that?

share|improve this question
up vote 1 down vote accepted

All of the custom field functions accept the post id as a parameter. You can use all those functions directly without the need to actually retrieve the post itself.

share|improve this answer
Also, when fetching with get_posts, WP_Query, etc, all meta fields and taxonomies are usually prefetched and cached, so each call to get_post_meta will be server from cache rather than hitting the db. – kovshenin Mar 13 '13 at 20:00

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.