Site icon Hip-Hop Website Design and Development

Find out how to get a number of fields from wp_query?

I’ll get a number of fields from wp_query end result. I learn about wp_list_pluck() perform, nevertheless it accepts just one area paramether. Find out how to get a number of ones if I might prefer to take a number of parameters from every put up discovered?

[
    Object1 (ID, name, tag),
    Object2 (ID, name, tag),
    Object3 (ID, name, tag),
    etc.
]

Thanks on your assist afterwards!

My code excerpt is right here:

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

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

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

$question = new WP_Query( $args );

$hey = [
    'ID' => wp_list_pluck($query->get_posts(), 'ID'),
    'post_title' => wp_list_pluck($query->get_posts(), 'post_title')
];