Network-activated WordPress plugin providing universal multisite search functionality for the Extra Chill Platform. Searches across all sites in a WordPress multisite network and displays unified results.
- Universal Multisite Search - Search all network sites or specific sites with single function call
- Dynamic Site Discovery - Uses
get_sites()to enumerate network sites with automatic WordPress blog-id-cache for performance - Flexible Post Type Support - Searches all public post types (posts, pages, custom post types, bbPress topics/replies)
- Advanced Filtering - Full
WP_Queryparameter support including meta queries - Relevance Scoring - Weighted algorithm prioritizing exact matches, phrase matches, and word-level matching
- Contextual Excerpts - Generates search-term-centered excerpts with highlighted matches
- Cross-Site Pagination - Results sorted chronologically across all sites with 404 fix for paginated queries
- Pagination 404 Fix - Automatically resolves WordPress 404 errors on paginated search across network sites
- Site Badges - Visual indicators showing which site each result originates from
- WordPress: 5.0+
- PHP: 7.4+
- Multisite: WordPress multisite installation required
- Theme: ExtraChill theme (for template integration)
Build the production ZIP with ./build.sh (symlinked to /.github/build.sh).
Deployments and remote operations run through Homeboy (homeboy/ in this repo).
The build artifact is build/extrachill-search.zip.
// Basic search
$results = extrachill_multisite_search( 'search term' );
// Search returns array of post objects with site metadata
foreach ( $results as $result ) {
echo $result['post_title']; // Post title
echo $result['site_name']; // Site name
echo $result['permalink']; // Full URL to post
}$results = extrachill_multisite_search(
'search term',
array( 'community.extrachill.com', 'extrachill.com' )
);$results = extrachill_multisite_search(
'search term',
array(), // Empty array = all sites
array(
'limit' => 20,
'offset' => 0,
'post_status' => array( 'publish' ),
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => '_bbp_forum_id',
'value' => '1494',
'compare' => '!=',
),
),
)
);// Get paginated search results with total count
list( $results, $total ) = extrachill_get_search_results( $_GET['s'], $page, $per_page );
// Generate pagination UI
extrachill_search_pagination( $total, $per_page, $page, $_GET['s'] );
// Get contextual excerpt with search term highlighted
$excerpt = ec_get_contextual_excerpt_multisite( $post_content, $search_term, 300 );The plugin searches across all sites in your WordPress multisite network. In the Extra Chill Platform, this includes all 10 active sites:
- extrachill.com - Main site (Blog ID 1)
- community.extrachill.com - Forums (Blog ID 2)
- shop.extrachill.com - E-commerce (Blog ID 3)
- artist.extrachill.com - Artist platform (Blog ID 4)
- events.extrachill.com - Events calendar (Blog ID 7)
- stream.extrachill.com - Live streaming (Blog ID 8)
- newsletter.extrachill.com - Newsletter (Blog ID 9)
- docs.extrachill.com - Documentation (Blog ID 10)
- wire.extrachill.com - News wire (Blog ID 11)
- horoscope.extrachill.com - Horoscopes (Blog ID 12)
array(
'ID' => 123, // Post ID
'post_title' => 'Post Title', // Post title
'post_content' => 'Full content...', // Full content
'post_excerpt' => 'Excerpt...', // Excerpt
'post_date' => '2025-10-07 12:00:00', // Publication date
'post_type' => 'post', // Post type
'post_name' => 'post-slug', // Post slug
'post_author' => 1, // Author ID
'site_id' => 1, // Blog ID
'site_name' => 'Extra Chill', // Site name
'site_url' => 'extrachill.com', // Site URL
'permalink' => 'https://...', // Full post URL
'taxonomies' => array( // Taxonomy terms
'category' => array( 'term_name' => term_id ),
),
)- Static Caching - Network sites cached in memory
- WordPress Blog-ID-Cache - Automatic blog ID caching for optimal performance
- Efficient Blog Switching - Minimal context switching with proper error handling
- Relevance Scoring - Weighted algorithm sorts results by match quality before pagination
- Cross-Site Date Sorting - Results sorted chronologically across all sites
WordPress native search only checks the current site for results. When paginating multisite search results, if the current site has no matching posts on a given page, WordPress returns 404 even though other network sites may have results.
The plugin intercepts these 404 errors via the template_redirect hook, queries all network sites to verify results exist, and overrides the 404 status when multisite results are found. This ensures pagination works correctly across all network sites.
The plugin expects your theme to provide:
extrachill_breadcrumbs()- Breadcrumb navigationextrachill_no_results()- No results messageextrachill_display_taxonomy_badges()- Taxonomy badge displayinc/archives/post-card.php- Post card template
extrachill_before_body_content- Before main content areaextrachill_after_body_content- After main content areaextrachill_search_header- Search results header areaextrachill_archive_below_description- Below archive descriptionextrachill_archive_above_posts- Above posts loop
The plugin uses the ExtraChill theme's template routing filter:
add_filter( 'extrachill_template_search', array( $this, 'override_search_template' ), 10 );This integrates with the theme's universal template routing system located in inc/core/template-router.php.
extrachill-search/
├── extrachill-search.php # Main plugin file
├── inc/
│ ├── core/
│ │ ├── search-functions.php # Core multisite search functionality
│ │ └── taxonomy-functions.php # Taxonomy helpers
│ └── templates/
│ ├── template-functions.php # Template helper functions
│ └── site-badge.php # Site badge display component
├── templates/
│ └── search.php # Search results template
├── build.sh # Production build script
├── .buildignore # Build exclusions
├── CLAUDE.md # Developer documentation
└── README.md # This file
# Create production ZIP file
./build.sh
# Output: Only /build/extrachill-search.zip file# Check PHP syntax
php -l extrachill-search.php
# Test search function (requires WordPress environment)
wp eval 'print_r(extrachill_multisite_search("test"));'- Issues: GitHub Issues
- Documentation: See CLAUDE.md for detailed developer documentation
- Website: Extra Chill Platform
Chris Huber
- Website: chubes.net
- GitHub: @chubes4
- Extra Chill: extrachill.com
GPL v2 or later