Skip to content

Loupe Cross-Site Search

Cross-site search for WordPress multisite, built as an add-on to Loupe Search. It maintains one combined Loupe index across the sites in your network and exposes a single search endpoint on a designated hub site, so a visitor can search every participating site at once and get one ranked list of results.

  • Combined index. Instead of querying each site’s index at search time, the add-on mirrors documents from every participating site into a single index (one Loupe database per post type) stored at a network-global path. Ranking and pagination are then a single, native operation. (ADR 0001)
  • In-context mirroring, no switch_to_blog. Each site mirrors its own posts into the combined index from within its own request context, reusing Loupe Search’s document builder so per-site options and filters apply. Backfill runs each site in its native context via a separate WP-CLI bootstrap. (ADR 0002)
  • Composite identity. Documents are keyed {blog_id}_{post_id} and store blog_id, blog_name, and url, so results carry site attribution and link correctly across the network.
  • Public, published content only. Mirrors what Loupe Search itself exposes.
  • Complete search block. A ready-to-use Cross-Site Search block ships with the plugin: site and post-type facets, sorting, highlighted snippets, pagination, and result attribution — all configurable in the block inspector.

Design decisions are recorded in docs/adr/ and the domain glossary in CONTEXT.md.

  • WordPress multisite 6.9+
  • Loupe Search active on the network
  • PHP 8.3+ with pdo_sqlite, intl, mbstring (same as Loupe Search)
  1. Download loupe-cross-site-search.zip

  2. Go to Network Admin → Plugins and upload loupe-cross-site-search.zip, then activate the plugin network-wide.

  3. Go to Network Admin → Settings → Cross-Site Search and configure the hub site, participation, language, and post types.

  4. Build the combined index:

    Terminal window
    wp loupe-cross-site reindex

Once installed, the plugin updates itself from GitHub releases (via soderlind/wordpress-github-updater) — new releases appear on the WordPress Plugins update screen.

Section titled “Network Admin → Settings → Cross-Site Search”
SettingDescription
Hub siteThe site that exposes the cross-site search REST endpoint. Defaults to the network’s main site.
ParticipationAll public sites, an allowlist, or a blocklist of sites.
Index languageTwo-letter code used to tokenize the combined index (single language for the whole index). (ADR 0004)
Post typesWhich post types are mirrored into the combined index.

After changing participation, language, or post types, run wp loupe-cross-site reindex.

The plugin ships a ready-to-use Cross-Site Search block. Add it to any page or post on the hub site (or any same-origin site) and visitors can search the whole network from the front end — no code required.

  • Debounced search-as-you-type with a clear button and loading state.
  • Facets for site and post type (checkboxes with live counts) that filter the results; a “Clear filters” control appears when any are active.
  • Sorting: Relevance, Newest, Oldest, or Title.
  • Highlighting of matched terms with cropped snippets (<mark>), sanitized before rendering.
  • Per-result site badge, post-type label, and date.
  • Pagination and a result count with query timing.
  • Empty, loading, and error states with ARIA live regions.
SettingDefaultDescription
HeadingOptional heading above the search box
PlaceholderSearch…Search input placeholder
Results per page10Between 1 and 50
Site filteronShow the site facet
Post type filteronShow the post-type facet
SortingonShow the sort control
Default sortRelevanceRelevance / Newest / Oldest / Title
Show excerptonRender highlighted snippets
Show dateonShow each result’s date
Highlight matchesonRequest and render match highlighting

On subdomain multisite the block makes a cross-origin request to the hub; place it on the hub site, use a subdirectory network, or add CORS headers. Prefer building your own UI? Query the REST API directly — see the developer guide.

The REST API, search block, WP-CLI commands, extension filters, and test commands are documented in the developer guide. See also the architecture overview, decisions, and the domain glossary in CONTEXT.md.

GPL-2.0-or-later. Copyright © Per Søderlind.