Replace WordPress default search with Meilisearch across your entire multisite network with automatic autocomplete.
- π Network-wide search - Search across all sites in your WordPress multisite network
- β‘ Lightning fast - Powered by Meilisearch's instant search engine
- π Automatic autocomplete - Real-time search suggestions as you type
- π― Easy configuration - Network admin settings page with connection testing
- π§ WP-CLI support - Bulk indexing and management via command line
- π Auto-sync - Content automatically indexed on publish/update
- π Modern PHP - Uses Fiber + ReactPHP for concurrent operations (PHP 8.1+)
- π Real-time Metrics - Monitor index statistics and performance without cache
- π Index Analyzer - Automatically detect multiple WordPress networks and their index patterns
- π Multi-Pattern Search - Search across multiple WordPress networks simultaneously
- WordPress 6.0+
- WordPress Multisite
- PHP 8.1+
- Self-hosted Meilisearch instance
- Composer (for development)
Follow the official Meilisearch installation guide.
For Docker:
docker run -d \
--name meilisearch \
-p 7700:7700 \
-e MEILI_MASTER_KEY=your-master-key \
-v $(pwd)/meili_data:/meili_data \
getmeili/meilisearch:latest- Clone or download this repository to
wp-content/plugins/meilisearch - Run
composer install --no-devin the plugin directory - Network activate the plugin in WordPress Network Admin
- Go to Network Admin β Settings β Meilisearch
- Enter your Meilisearch host URL (e.g.,
http://localhost:7700) - Enter your Meilisearch master key
- Enable the plugin
- Save settings
Use WP-CLI to index all sites:
wp meilisearch index --networkOr index a specific site:
wp meilisearch index --url=site.example.comThe plugin is configured only in the Network Admin panel:
- Network Admin β Meilisearch β Dashboard - Overview and quick access
- Network Admin β Meilisearch β Settings - Configure connection and index format
- Network Admin β Meilisearch β Metrics - Real-time index statistics (no cache)
- Network Admin β Meilisearch β Index Analyzer - Detect multiple WordPress networks and patterns
- Network Admin β Meilisearch β Multi-Pattern Search - Configure cross-network search
- Network Admin β Meilisearch β Experimental - Enable/disable experimental Meilisearch features
Settings are stored network-wide using get_site_option().
The Index Analyzer page helps identify and manage multiple WordPress networks sharing the same Meilisearch server:
- Automatic Pattern Detection - Analyzes all indexes to identify naming patterns
- Network URL Discovery - Maps index patterns to their WordPress network URLs
- Multi-Network Support - Perfect for hosting multiple WordPress installations
- Real-time Analysis - No caching, always shows current state
This is especially useful when:
- Managing multiple WordPress Multisite installations
- Each network uses different index naming formats
- You need to identify which indexes belong to which network
The Multi-Pattern Search page allows you to search across multiple WordPress networks that share the same Meilisearch server:
- Cross-Network Search - Include results from other WordPress networks in your searches
- Pattern Selection - Choose which index patterns to include in search results
- Real-time Configuration - Changes take effect immediately without reindexing
- Visual Interface - Easy checkbox selection with network URL display
Use cases:
- Corporate Portals - Search across public and internal networks
- Multi-Brand Sites - Unified search across different brand networks
- Migration Support - Include both old and new index patterns during transitions
See full Multi-Pattern Search documentation for detailed usage.
O plugin inclui comandos WP-CLI completos para gerenciamento. Veja a documentaΓ§Γ£o completa.
# Verificar saΓΊde do servidor Meilisearch
wp meilisearch health
# Listar todos os Γndices
wp meilisearch list_indexes
# Reindexar todos os blogs da rede
wp meilisearch reindex
# Reindexar blog especΓfico
wp meilisearch reindex --blog_id=2
# Buscar posts
wp meilisearch search "termo de busca"
# Ver estatΓsticas
wp meilisearch stats
# Criar Γndice manualmente
wp meilisearch create_index 2
# Deletar Γndice
wp meilisearch delete_index 2 --yesPara mais detalhes, exemplos e casos de uso, consulte docs/WP-CLI.md.
Each site in the network gets its own Meilisearch index:
- Site 1:
wp_1_posts - Site 2:
wp_2_posts - Site 3:
wp_3_posts
When a search is performed, the plugin:
- Intercepts the WordPress search query (
pre_get_postshook) - Performs a multi-index search across all network sites
- Returns combined results ordered by relevance
- Maintains WordPress pagination
Content is automatically indexed when:
- A post is published or updated (
save_posthook) - A post is deleted (
delete_posthook) - A new site is created (
wpmu_new_bloghook) - A site is deleted (
wp_delete_sitehook)
The plugin indexes:
- All post types (posts, pages, custom post types)
- Post metadata (title, content, excerpt)
- Taxonomies (categories, tags)
- Author information
- Timestamps for sorting
# Install dependencies (Pest 4.x requires PHP 8.3+)
composer install
# Run tests (Pest)
composer test
# or
vendor/bin/pest
# Run tests with coverage
composer test:coverage
# Check code standards (phpcs is installed globally via Composer:
# composer global require squizlabs/php_codesniffer wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp
# ensure the Composer global bin dir is on your PATH, e.g. $(composer global config bin-dir --absolute))
phpcs
# Auto-fix code standards
phpcbf
# Lint / static analysis (mago)
composer mago:lint
composer mago:analyze
# Generate API documentation
bash bin/generate-docs.sh
# Or with composer
composer docsTesting: unit tests use Pest 4.x and run in isolation with lightweight stubs for the WordPress functions they touch β no WordPress install or database is required. Because Pest 4 requires PHP 8.3+, the test suite runs on PHP 8.3 even though the plugin itself supports PHP 8.1+.
meilisearch/
βββ includes/
β βββ class-client.php # Meilisearch client wrapper
β βββ class-indexer.php # Indexing logic
β βββ class-searcher.php # Search queries
β βββ class-autocomplete.php # Autocomplete API
β βββ class-cli.php # WP-CLI commands
βββ admin/
β βββ class-dashboard.php # Dashboard overview
β βββ class-metrics.php # Real-time metrics page
β βββ class-index-analyzer.php # Network pattern analyzer
β βββ class-network-settings.php # Network admin UI
βββ public/
β βββ class-search-override.php # Frontend search replacement
βββ assets/
β βββ js/autocomplete.js # Frontend autocomplete
β βββ css/autocomplete.css # Autocomplete styles
βββ docs/
β βββ WP-CLI.md # WP-CLI documentation
βββ .github/
βββ copilot-instructions.md # AI agent instructions
The plugin uses PHP 8.1 Fibers for concurrent indexing:
$fiber = new Fiber(function() use ($site) {
switch_to_blog($site->blog_id);
// Index posts for this site
restore_current_blog();
});
$fiber->start();Searches across all network indexes simultaneously:
$results = $client->multiSearch([
['indexUid' => 'wp_1_posts', 'q' => $query],
['indexUid' => 'wp_2_posts', 'q' => $query],
['indexUid' => 'wp_3_posts', 'q' => $query],
]);Real-time suggestions via REST API:
GET /wp-json/meilisearch/v1/autocomplete?q=search+term
Check that Meilisearch is running:
curl http://localhost:7700/healthReindex all content:
wp meilisearch reindex --networkCheck index status:
wp meilisearch status --network- Ensure Meilisearch has adequate resources
- Consider increasing batch size in
class-indexer.php - Use a dedicated Meilisearch instance for production
GPLv2 or later
Contributions are welcome! Please follow WordPress coding standards and include tests for new features.
- Built with Meilisearch PHP SDK
- Uses ReactPHP for async operations
- Developed for WordPress Multisite networks