Modify default seach query
-
Hello!
I would like to modify the default search query that it could be able to search only in pages and its own child pages.
I mean, an user is browsing “Soccer” page. This page has a lot of subpages (“Team A”, “Team B” etc.). On the same level of “Soccer” I have also “Volleyball” and “Basket”, but I would like to show search results only of pages under the parent page.
I’ve found this code:
$query->query_vars['child_of']= parent_page_id;
Where “parent_page_id” will be a Worpress function that retrieve the ID.But, I don’t know where to place that code to change automatically the search query when the search button is clicked.
So, Where I have to place that code?
Thanks
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Modify default seach query’ is closed to new replies.