I'm going to get several fields from wp_query result. I know about wp_list_pluck() function, but it accepts only one field paramether. How to get several ones if I'd like to take several parameters from each post found?

    Object1 (ID, name, tag),
    Object2 (ID, name, tag),
    Object3 (ID, name, tag),

Thank you for your help afterwards!

My code excerpt is here:

$search_param = get_param('search_param', null, 'text'); // POST param

$term_id = get_term_by('name', "$search_param", 'image_color')->term_id;

$args = array(
    'post_type' => 'any',
    'post_status' => 'any',
    'meta_query' => array(
            'key' => 'image_color',
            'value' => sprintf( 's:%s:"%s"', strlen($term_id), $term_id ),
            'compare' => 'LIKE'

$query = new WP_Query( $args );

$hello = [
    'ID' => wp_list_pluck($query->get_posts(), 'ID'),
    'post_title' => wp_list_pluck($query->get_posts(), 'post_title')

1 Answer 1


Try to set 3-rd parametr for wp_list_pluck function, as i see if it's not set then there's happaning an unnessesery, for you, loop. Try to set it to true or some, not existing in Object, key.

Hope it helps.

  • Is it possible to use wp_filter_object_list function for my case? Jan 5, 2015 at 12:12
  • Sorry for late answer, yes you might, just try it and if it works than fine )) Jan 13, 2015 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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