0

So i need to pass multiple values but i dont know how? Any suggestion?

$myarray = array('144', '246');

$images = get_children(array(
    'title_li'     => '',
    'post_parent'       => $myarray,
    'sort_order'    => 'DESC',
    'sort_column'   => 'menu_order'
    )
    );

1 Answer 1

2

You can do this with WP_Query object :

$children_query = new WP_Query(array(
    'post_type'       => 'attachment',
    'orderby'         => 'menu_order',
    'order'           => 'DESC',
    'post_parent__in' => array('144', '246')
));
if($children_query->have_posts()){
    while($children_query->have_posts()){
        $children_query->the_post();
        // your display
    }
    wp_reset_postdata();
}

This will look for all media attached to any post of the array

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.