| 开发者 | brokensmile.2103 |
|---|---|
| 更新时间 | 2026年8月5日 01:03 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
<input name="s"> 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.
Want typo-tolerant, sub-50ms relevance ranking on top of that? Connect your own self-hosted or cloud Meilisearch instance in a few clicks — Init Live Search will automatically prefer it for search, and just as automatically fall back to the built-in database search if it's ever unreachable. Your visitors never see a broken search box.
It also brings AI-powered related posts and an advanced keyword generator — giving your visitors smarter ways to discover content.
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
/wp-content/plugins/ or install via the WordPress admin panel.<input name="s"> fielddata-ils attribute#search or ?modal=search&term=your+keywordinit-live-search category — init-live-search/search-posts (runs the plugin's search engine and returns matching results) and init-live-search/get-related-posts (returns posts related to a given post ID). Both are discoverable and executable via PHP, wp_get_abilities(), and — when a site opts in — the wp-abilities/v1 REST namespace. Fully optional and backward-compatible: on WordPress versions older than 6.9, the integration silently does nothingblock.json (with a PHP render.php file wired through the "render" field, WP 6.1+) that calls the exact same shortcode function as its shortcode counterpart — no duplicated display logic, output always matches:[init_live_search][init_live_search_related_posts][init_live_search_related_ai]
The editor integration is a single, no-build-step vanilla JavaScript file using wp.serverSideRender for a live preview directly in the editor. CSS for both the editor preview and the frontend is declared once via block.json's "style" field (matching your chosen "CSS Style" setting), so WordPress enqueues it automatically wherever it's needed — no manual enqueue callsRequires at least raised from 5.9 to 6.9 to support the Abilities API integration. Requires PHP remains 7.4wp_set_script_translations() with an explicit path to this plugin's languages/ directory) and the block.json metadata strings (via the standard PHP .mo/gettext mechanism)Tested up to: 7.1wp_next_scheduled() check could catch it in that gap. Status detection now also checks whether a batch is actively processing, and the page load immediately after clicking Save shows a neutral "Checking indexing status…" message instead of guessing right or wrong — it's simply too early to know at that pointHTTP error 413 from Meilisearch. A batch's JSON payload size depends on post content, not just post count, so a fixed batch size that works on one site can exceed Meilisearch's (or a reverse proxy's) payload size limit on another. The background reindex, the "Reindex Now" button, and wp init-live-search meili-reindex now automatically split an oversized batch and retry with smaller payloads; if a single post is still too large on its own, it's skipped (with a warning listing the post ID) instead of blocking the entire reindexwp init-live-search meili-reindex now only need Host and Index to be filled in — useful for building or testing a new index while the current search source (database or an existing Meilisearch index) keeps running, without switching it live first. Auto-sync on save/delete still only starts once the checkbox is enabled, as beforeLIKE '%term%' for Title/Excerpt/Content matching on the standard database search pipeline — a major speed-up on sites with a large number of postswp init-live-search fulltext-reindex to build or rebuild the FULLTEXT index manually/fasterwp init-live-search meili-reindex<script> block into admin.js (enqueued properly via wp_enqueue_script), in line with WordPress Coding Standards; translated strings are passed through via wp_localize_script so existing translations are unaffectedwp init-live-search meili-reindex to bulk-index (or rebuild) all published posts of the enabled post types into Meilisearch.INIT_LIVE_SEARCH_MEILI_ADMIN_KEY constant in wp-config.php (recommended) instead of being stored in the databaseinit-live-search text domain, per WordPress.org standards; .pot regenerated and the Vietnamese .po/.mo translation updated with 27 new/previously-missing strings translatedscript.js) now use AbortController to cancel stale in-flight requests when the user keeps typing, preventing older/slower responses from overwriting newer search results+word/-word now correctly narrow the results of the plain search terms instead of being merged into the same fuzzy/fallback pool. Plain words still drive the base search (with all existing fuzzy matching, synonyms, and fallback logic intact); +word requires the narrowed results to also contain that word, -word excludes results containing it — supporting multiple +/- operators in the same query (e.g. wordpress -plugin -theme)sale, visa, gym, vintage) that were silently overwriting earlier synonym definitionsloadMoreRecent() to prevent a potential crash when an item is missing its data-url attribute; normalized trailing-slash URL comparison in loadMoreGeneric() to prevent possible duplicate items when loading more resultsrelated_only_single and related_exclude_slugs before auto-injecting /related into the search modal, preventing unwanted related searches on archives, pages, or excluded pathsrelated_only_single and related_exclude_slugs are properly sanitized via the existing settings flow with keyword trimming and line-by-line validationwp-image-{ID} classes and retrieves the proper WordPress thumbnail size using attachment metadata<img src=""> URL before using the default thumbnailinit_plugin_suite_live_search_allow_fallback_image_host for customizing allowed fallback image hosts