[wp-hackers] multiple calls to get_post_meta back to back as opposed to one call
Haluk Karamete
halukkaramete at gmail.com
Thu Feb 7 21:30:22 UTC 2013
This question can be formulated as
Would it make sense ( from the mysql quiery point of view ) to build a
functionality so that the following 2 liner code
$fields = array('field_1','field_2',....'field_10');
extract(get_post_metas($post->ID,$fields,true));
will practically be speaking equal to something like
$field_1 = get_post_meta($post->ID,'field_1',true);
$field_2 = get_post_meta($post->ID,'field_2',true);
...
$field_10 = get_post_meta($post->ID,'field_10',true);
First approach will be done with a single but slightly more
complicated query whereas the latter will force 10 sql queries they
tend to be simpler.
What are your thoughts?
More information about the wp-hackers
mailing list