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
composer install
# Setup WordPress test environment
bash bin/install-wp-tests.sh wordpress_tests root mysql localhost latest
# Run tests
vendor/bin/phpunit
# Check code standards
vendor/bin/phpcs
# Auto-fix code standards
vendor/bin/phpcbf
# Generate API documentation
bash bin/generate-docs.sh
# Or with composer
composer docsmeilisearch/
├── 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