
Init Live Search – Smart, Slash Commands, REST API
by Hao Nguyen on WordPress.org
Fast, modern live search powered by REST API — with slash commands, SEO-aware, ACF, WooCommerce, and custom UI presets.

Search Triggers: input focus, Ctrl + /, triple click, data-ils
attribute
Deliver an ultra-responsive search experience to your visitors — no page reloads, no jQuery, no lag. Init Live Search is a modern, lightweight, and fully accessible live search solution for WordPress — now with tag-aware matching, SEO metadata support, ACF integration, WooCommerce product filters, and customizable UI presets.
It replaces the default with a clean, intuitive search modal powered entirely by the WordPress REST API. Everything loads in real-time — with zero disruption to browsing flow.
Perfect for content-heavy blogs, WooCommerce stores, or even headless sites. Every interaction is fast, fluid, and designed to work across devices.
This plugin is part of the Init Plugin Suite — a collection of minimalist, fast, and developer-focused tools for WordPress.
GitHub repository: https://github.com/brokensmile2103/init-live-search
What’s New in Version 1.7.x
- Cross-site Search: merge results from multiple Init Live Search-enabled sites
- Just enter
Site Name|https://example.com/
— no auth or CORS needed - Automatically tags results by site (e.g. “Init Docs”)
- Now disables single-word fallback on both local and remote sites for cleaner relevance
- Just enter
- WooCommerce Slash Commands: major expansion for store owners
- New:
/brand
,/attribute
,/variation
, and/coupon
/coupon
shows active coupons with usage and expiration info- Improved
/price
with optionalsort
/rsort
- Fully supports custom taxonomies and
pa_...
attributes
- New:
- New Shortcode:
[init_live_search]
- Insert a search input or icon anywhere
- Supports dark mode and custom classes
- Keyword Operators: precision search using
+
and-
- Use
+
to require keywords (e.g.+nginx +ubuntu
) - Use
-
to exclude terms (-centos
will filter out CentOS-related posts) - Works across all post types and supports synonym and fallback logic
- Use
- Related Posts Shortcode:
[init_live_search_related_posts]
- Display related posts using smart title-based matching
- SEO-friendly: no REST call, renders full HTML
- Includes template override support and optional schema markup
- Auto layout: 2 columns on desktop if result count ≥ 10
- Auto Insert Related Posts: display related posts without needing a shortcode
- Options: after content, before/after comment form
- Enabled via settings “Auto Insert Related Posts?”
- Respects selected post types and includes filter for conditional logic
- Uses
[init_live_search_related_posts template="grid" count="6"]
by default
- Related Posts Templates: switch layouts easily using
template
attribute- Built-in:
default
,grid
,classic
,compact
,thumbright
- All templates fully overrideable via
init-live-search/related-posts-{template}.php
- Smart fallback to
default
if missing - Includes alt text filter and optional schema output
- Built-in:
Features
Packed with everything a modern live search needs — and more:
- Live search via REST API (no admin-ajax, no jQuery)
- Smart tag-aware search mode (title + tag match)
- SEO metadata support: Yoast, Rank Math, AIOSEO, SEOPress, TSF
- ACF field matching and customizable filters
- Synonym expansion with fallback scoring logic
- Slash commands:
/recent
,/popular
,/tag
,/id
,/sku
,/price
,/coupon
, etc. - WooCommerce support: search by product, SKU, brand, attribute, variation, coupon
- Clean modal UI with keyboard navigation (
) Enter Esc
- Optional voice input (SpeechRecognition)
- Tooltip Quick Search (select text to trigger)
- Favorites system via heart icon or
/fav
commands - Infinite scroll and smart category filter (no extra API)
- Deep linking:
?modal=search&term=...
- New
[init_live_search]
shortcode: insert input or icon anywhere - UI presets: default, fullscreen, topbar — with full CSS override
- Local caching + analytics (CSV export, no personal data)
- Developer-ready: custom slash commands, REST filters, JS hooks
Dark Mode Support
Enable dark mode for the modal by either:
-
Adding the dark class:
document.querySelector(‘#ils-modal’)?.classList.add(‘dark’);
-
Or using a global config:
window.InitPluginSuiteLiveSearchConfig = { theme: ‘dark’ };
Options: dark
, light
, auto
Admin Settings
- Choose post types to include in search
- Configure modal triggers (input focus, triple click, Ctrl+/)
- Enable slash commands (e.g. /recent, /tag, /id)
- Enable support for
+
and-
keyword operators (must-have, must-not-have) - Set default slash command to run on modal open (only if slash is enabled)
- Set debounce time and max results
- Choose search mode (title-only, tag-aware, full content)
- Define custom ACF fields to include in search (optional)
- Enable Search in SEO Metadata (Yoast, Rank Math, etc.)
- Toggle excerpt display below each result (1-line contextual snippet)
- Toggle fallback logic (bigram/trim)
- Enable synonym expansion and manage synonym mappings (JSON editor)
- Enable Search Analytics to log queries (no personal data stored)
- Set max words for tooltip search
- Enable voice input (SpeechRecognition API)
- Enable result caching (localStorage)
- Choose frontend UI style (default, fullscreen, or topbar)
- Allow theme override via
init-live-search/style.css
- Automatically insert related posts after content or comments (optional)
- Option to disable all built-in CSS completely
- Add default UTM parameter to result links
- Define or auto-generate keyword suggestions
Keyboard Shortcuts
- Arrow Up / Down — navigate between results
- Arrow Right — add selected result to favorites (if not already added)
- Arrow Left — remove selected result from favorites
- Enter — open selected result or submit
- Escape — close modal and reset state
- Slash (/) — start a command instantly (e.g.,
/recent
,/id 123
)
Developer Reference: Shortcodes, Filters, and Hooks
Shortcodes
[init_live_search]
Display a search icon or input anywhere that opens the Init Live Search modal.
Attributes:
– type
: icon
(default) or input
– choose between a clickable icon or a search box
– placeholder
: (optional) text inside the input if type="input"
– label
: (optional) adds a label next to the icon if type="icon"
– class
: (optional) add custom classes like dark
, my-style
, etc.
– stroke_width
: (optional) set the stroke width for the search icon (default: 1
)
– radius
: (optional) override the border radius of the input form (default: 9999px
from CSS; only applied if value differs)
[init_live_search_related_posts]
Display a list of related posts (static HTML) based on post title or keyword, optimized for SEO and fully themable.
Attributes:
– id
: (optional) the post ID to find related posts for (defaults to current post)
– count
: (optional) number of posts to display (default: 5
)
– keyword
: (optional) override the keyword used for finding related posts
– template
: (optional) layout template to use — default
, grid
, classic
, compact
, thumbright
– css
: 1
(default) or 0
– disable default CSS if you want to fully style it yourself
– schema
: 1
(default) or 0
– disable JSON-LD ItemList
output for SEO schema
Filters for Developers
This plugin includes multiple filters to help developers customize behavior and output at various stages of the search flow.
init_plugin_suite_live_search_enable_fallback
Enable or disable fallback logic (trimming or bigram) when few results are found.
Applies to: search
Params: bool $enabled
, string $term
, array $args
init_plugin_suite_live_search_post_ids
Customize the array of post IDs returned from the search query.
Applies to: search
Params: array $post_ids
, string $term
, array $args
init_plugin_suite_live_search_result_item
Modify each result item before it’s sent in the response.
Applies to: search
Params: array $item
, int $post_id
, string $term
, array $args
init_plugin_suite_live_search_results
Filter the final array of results before being returned.
Applies to: search
Params: array $results
, array $post_ids
, string $term
, array $args
init_plugin_suite_live_search_synonym_map
Inject or override the list of keyword synonym mappings used in synonym expansion logic.
Applies to: search
Params: array $map
init_plugin_suite_live_search_category
Customize the category label shown in search results.
Applies to: all endpoints
Params: string $category_name
, int $post_id
init_plugin_suite_live_search_default_thumb
Override the default thumbnail if the post lacks a featured image.
Applies to: all endpoints
Params: string $thumb_url
init_plugin_suite_live_search_query_args
Modify WP_Query arguments for recent, date, taxonomy-based, or product-based commands.
Applies to: recent
, date
, tax
, product
, random
Params: array $args
, string $type
, WP_REST_Request $request
init_plugin_suite_live_search_stop_single_words
Customize the list of single-word stopwords removed before generating bigram.
Applies to: keyword suggestion
Params: array $stop_words
, string $locale
init_plugin_suite_live_search_stop_words
Customize the stop-word list used when auto-generating suggested keywords.
Params: array $stop_words
, string $locale
init_plugin_suite_live_search_taxonomy_cache_ttl
Customize the cache duration (in seconds) for the /taxonomies
endpoint. Return 0
to disable caching.
Applies to: taxonomies
Params: int $ttl
, string $taxonomy
, int $limit
init_plugin_suite_live_search_filter_lang
Filter the list of post IDs by the current language. Supports Polylang and WPML.
Applies to: search, related, read, and other multilingual-aware endpoints
Params: array $post_ids
, string $term
, array $args
init_plugin_suite_live_search_category_taxonomy
Override the taxonomy used to fetch and display category labels in results.
Applies to: all endpoints
Params: string $taxonomy
, int $post_id
init_plugin_suite_live_search_seo_meta_keys
Customize the list of meta keys used for matching SEO Titles and Meta Descriptions.
Applies to: search (when Search in SEO Metadata is enabled)
Params: array $meta_keys
init_plugin_suite_live_search_weights
Customize the weighting array used to merge and sort post IDs from multiple sources (title, SEO, tag, etc.).
Applies to: search (search modes: title
, title_tag
, title_excerpt
)
Params: array $weights
, string $search_mode
init_plugin_suite_live_search_commands
Allow registration of custom slash commands to be displayed in the command list and handled via custom logic.
Applies to: slash command system (/
prefix input)
Params: array $commands
, array $options
init_plugin_suite_live_search_smart_post_thumbnail_alt
Allow overriding the generated alt
text for post thumbnails used in related post templates or result items.
Applies to: image accessibility / SEO rendering (alt
attribute)
Params: string $alt
, int $post_id
init_plugin_suite_live_search_auto_insert_enabled
Allow conditionally enabling or disabling auto-insertion of related posts based on the current position or post type.
Applies to: automatic shortcode injection via the_content
, comment_form_before
, comment_form_after
Params: bool $enabled
, string $position
, string $post_type
init_plugin_suite_live_search_default_related_shortcode
Customize the shortcode string used when auto-inserting related posts into post content or comment areas.
Applies to: automatic related post output
Params: string $shortcode
REST API Endpoints
Fully documented, lightweight, and API-first endpoints. Ideal for headless or decoupled builds.
All endpoints are under namespace: initlise/v1
-
/search?term=example
Standard search query (uses settings like post types, search mode, fallback…) -
/id/{id}
Fetch a post by ID. Returns permalink. -
/recent
Fetch the most recent posts based on plugin settings. -
/date?value=Y
,/date?value=Y/m
,/date?value=Y/m/d
Fetch posts by year, month, or day. -
/tax?taxonomy=category&term=slug-or-id
Fetch posts by taxonomy (e.g.,category
,post_tag
, or custom). -
/related?title=page-title&exclude=ID
Fetch posts related to the current page title (useful for showing similar articles). -
/read?ids=1,2,3
Fetch post data by IDs stored in localStorage (e.g., byInit Reading Position
plugin or custom logic). -
/random
Return a random published post based on settings. Redirects via JavaScript. -
/taxonomies?taxonomy=category
Return a list of taxonomy terms (e.g., categories, tags), sorted by count. -
/product?page=1&on_sale=1&in_stock=1&sku=ABC&min_price=100&max_price=500
Fetch WooCommerce products using flexible query parameters. Supports slash commands:/product
,/on-sale
,/stock
,/sku
,/price
.
Accepts:term
: Search keywordsku
: Partial or full SKU matchon_sale
:1
to filter products on salein_stock
:1
to filter products in stockmin_price
/max_price
: Numeric range filterprice_order
:sort
orrsort
to sort by pricebrand
,attribute
,variation
,value
: For taxonomy filteringpage
: For pagination
Returns basic product info (title, URL, price, category, thumbnail), sale and stock status, andadd_to_cart_url
. Caching is applied per query.
-
/coupon
Fetch valid WooCommerce coupons (non-expired and under usage limit).
Returns: code, description, remaining uses, expiration date, copy-to-clipboard support.
License
This plugin is licensed under the GPLv2 or later.
You are free to use, modify, and distribute it under the same license.