after browsing question from this site I found the workaround for this:
function SearchFilter($query) {
if ($query->is_search) {
global $post;
$query->set( 'post_parent', 21 );
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
When I do this, its only search child of parent 21 not child of child of parent 21.
Also, query_vars only accept single value for post_parent.
any solution for this is highly appreciated.
thanks
You can probably do something like this. It’s probably less efficient, but should find all descendants of a given page rather than just direct children.