DEV Community

Cover image for Init Live Search – Smarter WordPress Search with Slash Commands & REST API
Hao Nguyen
Hao Nguyen

Posted on • Edited on

Init Live Search – Smarter WordPress Search with Slash Commands & REST API

A fast, flexible live search modal for WordPress – powered by REST API, Meilisearch & slash commands

Init Live Search replaces the default WordPress search with a modern modal. Built on the REST API, it works instantly, supports keyboard navigation, slash commands, and now offers optional Meilisearch integration for typo-tolerant, sub-50ms relevance-ranked search — with automatic fallback to the local database if Meilisearch is ever unreachable.

No jQuery. No page reloads. No broken search box, ever.


What's New in v1.9.x

  • Optional Meilisearch Integration — connect your own self-hosted or cloud Meilisearch instance as the primary search engine, with silent, automatic fallback to local DB search
  • Auto-sync to Meilisearch — posts are pushed/removed from the index on publish, update, trash, and delete (non-blocking)
  • WP-CLI Reindexwp init-live-search meili-reindex for bulk indexing or full rebuilds
  • Cross-site Search — fetch & merge results from other Init Live Search-powered sites, no CORS or auth setup needed
  • New Shortcodes[init_live_search] and [init_live_search_related_posts], both buildable visually via the new Shortcode Builder UI
  • AI-Powered Related Posts[init_live_search_related_ai] using multi-signal scoring (tags, ACF, series, views, comments, freshness)
  • Template-based Layoutsgrid, classic, compact, thumbright, overridable from your theme
  • 404 Smart Redirect — automatically redirects broken URLs to the most relevant post
  • WooCommerce Slash Expansion — added /brand, /attribute, /variation, /coupon
  • Search Operators+musthave and -mustnot terms now supported in queries

Features at a Glance

Minimalist, Modern UX

  • Modal-based UI (Ctrl + /, triple-click, data-ils)
  • Instant results via REST API (no admin-ajax, no jQuery)
  • Infinite scroll support
  • Local caching with localStorage

Smarter Search Logic

  • Optional Meilisearch backend — typo-tolerant, relevance-ranked, sub-50ms, with automatic local-DB fallback
  • Match by title + tags with bi-gram fallback
  • Search in SEO metadata (Yoast, Rank Math, AIOSEO, TSF, SEOPress)
  • Support ACF fields (e.g. company_name)
  • Tunable ranking (e.g. title > SEO > tags)
  • Search operators: +musthave, -mustnot

Cross-site Search

  • Query and merge results from other Init Live Search-powered sites
  • No CORS or auth config — just Site Name|https://example.com
  • Results auto-labeled by source (e.g. "Init Docs")

Related Posts, Two Ways

  • [init_live_search_related_posts] — static, SEO-friendly, JSON-LD ready
  • [init_live_search_related_ai] — AI-scored, multi-signal (tags, ACF, series, views, comments, freshness)
  • Auto-insert after content/comments — no shortcode required
  • Layout templates: grid, classic, compact, thumbright
  • Fully overridable from your theme (init-live-search/related-posts-{template}.php)

Productivity Built-In

  • Slash commands: /recent, /id, /fav, /product, /sku, /price, etc.
  • Full keyboard support: ↑ ↓ ← → Enter Esc
  • Quick search tooltip when selecting text
  • Voice search via SpeechRecognition (optional)

WooCommerce Ready

  • Filter by SKU, stock, price, sale status, brand, attribute, variation, coupon
  • Show prices, badges, "Add to Cart"
  • Slash commands: /product, /on-sale, /stock, /sku, /brand, /attribute, /variation, /coupon

Theming & Customization

  • Built-in style presets: style-full.css, style-topbar.css
  • Theme override support (style.css in theme)
  • Optionally disable all plugin CSS
  • Dark mode (dark, light, auto)

Built for Developers

  • PHP filters to override queries, ranking, result data
  • REST API endpoints: /search, /product, /id, etc.
  • JS events: ils:search-started, ils:results-loaded, etc.
  • WP-CLI support for Meilisearch reindexing
  • Complete developer docs + override guide

Optional Lightweight Analytics

  • Track query count, frequency, timestamps (no personal data)
  • Grouped view, export as CSV
  • Disabled by default, uses WordPress transients

Meilisearch Integration (Optional)

Init Live Search works great out of the box with zero setup — the built-in database search handles everything by default. If you want faster, typo-tolerant, relevance-ranked search at scale, connect your own Meilisearch instance in a few minutes.

  1. Install and run Meilisearch yourself — self-hosted or via Meilisearch Cloud. This plugin doesn't host or manage a server for you.
  2. Go to Settings → Init Live Search → Meilisearch, enter your Host URL, Index Name, and a search-only API key, then enable the integration.
  3. Index your existing content:
   wp init-live-search meili-reindex
Enter fullscreen mode Exit fullscreen mode
  1. Done — search requests are now answered by Meilisearch. New, updated, and deleted posts stay in sync automatically.

Built for safety, not lock-in:

  • If Meilisearch is disabled, unconfigured, or fails to respond, the plugin silently falls back to local DB search — visitors never see a broken search box
  • The sensitive admin/indexing key can be set via the INIT_LIVE_SEARCH_MEILI_ADMIN_KEY constant in wp-config.php instead of the database
  • Turn it off any time — core search never depends on Meilisearch being present

Slash Command Examples

Command Action
/recent Show latest posts
/id 123 Load post by ID
/product List products
/sku ABC123 Find by SKU
/on-sale Show sale items
/price 100 500 Filter by price range (supports sort/rsort)
/brand Filter by product brand
/coupon Show active, usable coupons
/fav Show saved favorites (localStorage)
/random Jump to a random post

👉 Full Command Guide


Dev Tools You Get

  • JS events like ils:modal-opened, ils:results-loaded
  • PHP filters for SEO fields, fallback logic, ranking, and more
  • Theme override with custom style.css and related-posts templates
  • WP-CLI command for Meilisearch reindexing
  • Zero jQuery. Zero forced dependencies.

Installation

Install via WordPress.org or:

git clone https://github.com/brokensmile2103/init-live-search.git
Enter fullscreen mode Exit fullscreen mode

Then activate and configure in Settings → Init Live Search.

Ways to trigger the modal:

  • Focus any <input name="s">
  • Press Ctrl + /
  • Triple-click anywhere
  • Click elements with data-ils
  • URL: ?modal=search&term=seo

Part of the Init Plugin Suite

Init Live Search is part of the Init Plugin Suite – a set of minimalist, performance-first tools for WordPress developers.


Thanks for reading. Got feedback or questions?
Project Page
GitHub

Top comments (0)