Php WP,传递多个id';有什么问题吗

Php WP,传递多个id';有什么问题吗,php,wordpress,Php,Wordpress,} 例如,如何将两个参数作为post_id传递?唯一的方法是写入一些元查询吗?将post ID数组传递给中的post\u parent\u,per(假设$args代表WP\u查询参数): 将post ID数组传递给中的post\u parent\u,per(假设$args代表WP\u查询参数): function my_relationship_query( $args, $field, $post_id ) { // only show children of the current pos

}


例如,如何将两个参数作为post_id传递?唯一的方法是写入一些元查询吗?

将post ID数组传递给
中的
post\u parent\u,per(假设
$args
代表WP\u查询参数):


将post ID数组传递给
中的
post\u parent\u,per(假设
$args
代表WP\u查询参数):

function my_relationship_query( $args, $field, $post_id ) {

// only show children of the current post being edited
$args['post_parent'] = $post_id;


// return
return $args;
$post_id_array = array( $id1, $id2 );

function my_relationship_query( $args, $field, $post_id_array ) {

    // only show children of the current post being edited
    $args['post_parent__in'] = $post_id_array;

    // return
    return $args;
}