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;
}
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;
}