Reputation: 891
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;
}
How for example I could pass two parameters as post_id ? Is the only way of doing that includes writing some meta queries ?
Upvotes: 0
Views: 51
Reputation: 1508
Pass an array of post IDs to post_parent__in
, per WP_Query (assuming $args
is representative of WP_Query params):
$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;
}
Upvotes: 2