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?
1 Answer
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.
-
1Also, 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. Commented Mar 13, 2013 at 20:00