Limit results to current page children

Results only where the current post (or page or any cpt) is the parent

What is this, and where do I put this custom code?

add_filter('asp_query_args', 'asp_add_current_parent_dependency', 10, 1);
function asp_add_current_parent_dependency($args) {
if ( !empty($args['_page_id']) ) {
$args['post_parent'][] = $args['_page_id'];
$args['post_parent'] = array_unique($args['post_parent']);
}
return $args;
}

..same code, but to apply only for specific search instances:

add_filter('asp_query_args', 'asp_add_current_parent_dependency', 10, 2);
function asp_add_current_parent_dependency( $args, $id ) {
/**
* Search instance IDs you want this code to apply on.
*/
$search_ids = array(1, 2);
// -- !! Do not change anything below this line !! --
// --------------------------------------------------
if ( !empty($args['_page_id']) && in_array($id, $search_ids) ) {
$args['post_parent'][] = $args['_page_id'];
$args['post_parent'] = array_unique($args['post_parent']);
}
return $args;
}