Search Filter for Which Multisite You’re On
Say you have 4 sites on a multisite. They are:
- Top-Level Site
- Subsite 2
- Subsite 3
- Subsite 4
Site 1 is used as a top-level site. Right now, when you search, it gives you all 4 of the sites’ results. We want to add a search filter to select which site you search from (Probably a dropdown menu, but would be nice to support checkboxes for multiple selections for a more future-proof method).
Now for the code:
I have been hacking on the
pre_get_posts filter to handle all of the search filters.
The Real Question:
Is there a way to query by site ID or if not a best practice for this sort of thing?