add_filter( 'asp_query_args', 'asp_include_only_parent_ids', 10, 2 );
function asp_include_only_parent_ids( $args, $id ) {
/**
* Enter the post/cpt prent IDs here. The results will be
* limited to objects with these parent IDs.
*/
$ids = array(1, 2, 3, 4, 5, 6);
// -- !! Do not change anything below this line !! --
$args['post_parent'] = $ids;
return $args;
}
..same code, but to apply only for specific search instances:
add_filter( 'asp_query_args', 'asp_include_only_parent_ids', 10, 2 );
function asp_include_only_parent_ids( $args, $id ) {
/**
* Enter the post/cpt prent IDs here. The results will be
* limited to objects with these parent IDs.
*/
$ids = array(1, 2, 3, 4, 5, 6);
/**
* Search instance IDs you want this code to apply on.
*/
$search_ids = array(1, 2);
// --------------------------------------------------
// --------------------------------------------------
// -- !! Do not change anything below this line !! --
// --------------------------------------------------
if ( in_array($id, $search_ids) )
$args['post_parent'] = $ids;
return $args;
}