I need to display results of three different search queries on one page. More precisely, there is a searchbox on my page where a user enters a search phrase. Once the search phrase is submitted, I need to take the generated WP search query and modify it to build three different custom queries.
The results of these three queries will be then displayed on a page in separate blocks.
So for example, a user searches for the 'Honda' phrase. Then he gets the results of three search queries:
- 'Honda' in custom posts called 'Cars',
- 'Honda' in custom posts called 'Motorbikes',
- 'Honda' in custom posts called 'Tracks',
I know that the simplest way to modify a WP search query is to use the
pre_get_posts action hook, but I'm not sure how I can use it to create three separate queries.
Your advice will be much appreciated.