Search Filter for Which Multisite You’re On


Say you have 4 sites on a multisite. They are:

  1. Top-Level Site
  2. Subsite 2
  3. Subsite 3
  4. 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?

Stephen Sabatini 2 months 0 Answers 12 views 0

Leave an answer