Dave’s WordPress Live Search adds “live search” functionality to your WordPress site. As visitors type words into your WordPress site’s search box, the plugin continually queries WordPress, looking for search results that match what the user has typed so far.
The live search technique means that most people will find the results they are looking for before they finish typing their query, and it saves them the step of having to click a submit button to get their search results.
See filter_examples.php in
the plugin files for examples of how to use these filters. Remember, these filters only affect the
Dave’s WordPress Live Search display, not the normal WordPress search results or the posts themselves.
Features I want to implement in future releases:
- “No results found” message (optional)
Dave’s WordPress Live Search is a plugin that brings live search, sometimes called “autocomplete”, to your WordPress site. Many of the web’s most popular destinations use this technique so customers can get right to the information or products they’re after, and now you can deliver that same experience to your site’s visitors. Like WordPress itself, it’s designed to be simple to set up and use right away, but powerful and customizable for advanced users.
You can install the plugin right from WordPress itself by going to the Plugins section, clicking “Add New”, and searching for “Dave’s WordPress Live Search”. Click “install now” to add the plugin to your site. If you prefer to install the plugin manually, it’s available for download in the WordPress plugins directory.
After you install the plugin, go to the Settings menu and choose “Live Search”. Let’s take a look at the main “settings” tab, which controls how the plugin looks and behaves. The “Maximum Results to Display” option lets you limit the number of search results your users see. If you have a large site, you should set this to 5 or less or it might take a long time to display. Remember, your visitors can still click the “search” button like they normally would to get all the matching results. The “Minimum characters” option lets you choose how much people need to type before the plugin starts offering results. The longer you wait before showing results, the better the first set of results will be.
The “Results Direction” setting lets you choose whether the results should grow up or down from the search box. People are used to seeing the results underneath the box, but if space is tight on your site or blog, you should show them above the search box to make sure they fit on the screen.
You can also choose what’s included with the search results. They can include a thumnail image, excerpt, even who wrote the content and when. You may want to include the “View more results” link at the bottom of the search results, so users can click through to see more results.
Dave’s WordPress Live Search ships with three color schemes: gray, red, and blue. Advanced users and developers can use the other styling options to better match their site’s theme.
When you’re ready, save your changes, and Dave’s WordPress Live Search is ready to use. It automatically attaches itself to any search boxes in your theme, or any search widgets you add, giving your site’s visitors a better search experience with a minimum of fuss.
Excellent plugin. Took me a little while to figure out that you need to select a style in the appearances settings otherwise, none of the results are displayed.
I love how easy it is to use! I just installed plugin and activated then it works! and I can also adjust its style. I just want to thank you for making this awesome plugin. It makes my website looks a lot cooler than before! 😀
Great plugin, does what it’s supposed to do – except – it makes my site very slow. Each page with a search function delays the page load significantly. Had to remove.
When I try to activate the plugin, I get this error message “Plugin could not be activated because it triggered a fatal error. Fatal error: Cannot redeclare daves_wp_live_search_init() (previously declared in /Applications/MAMP/htdocs/wp-content/plugins/uncode-daves-wordpress-live-search/uncode-daves-wordpress-live-search.php:33) in /Applications/MAMP/htdocs/wp-content/plugins/daves-wordpress-live-search/daves-wordpress-live-search.php on line 48”
I’ve deactivated it and tried again with no luck. Can you assist me? Thanks!
Really like the live search. I combined it with ‘Search shortcode’ to set up an home page on an intranet that looks pretty much lik G**gle. Nice work, well done.
Just a suggestion (no criticism)
To make it 100% perfect it would be nice if a future version could provide optional search and reset buttons. I made a search button through a simple css button but could not do clear because the .reset() will not work. Here ist is in case anyone feels the urge. Just add you favourite button css.
<a href="#" onclick="document.getElementById('searchform').submit();">Search</a>
because it’s the only that seems to work well with my site…
Contributors & Developers
“Dave's WordPress Live Search” is open source software. The following people have contributed to this plugin.Contributors
- 2016-08-29 Dave Ross email@example.com
- Fixes deprecation warning on PHP 7.x
- Fixed issue where clicking anywhere but the title on 2nd+ search result went to 1st result
- 2015-10-15 Dave Ross firstname.lastname@example.org
- Changed text domain to ‘daves-wordpress-live-search’
- Added “Text Domain:” plugin header declaration
- Removed link to CrowdIn for translations
- Removed CrowdIn references from readme
- ^ All this in preparation for WordPress plugin language packs
- Removed Relevanssi reference from readme
- 2015-08-19 Dave Ross email@example.com
- Fixed issue excerpts not displaying
- Scripts are now enqueued in the footer
- Admin screen titles are now h1 instead of h2 in WordPress 4.3+
- 2015-05-10 Dave Ross firstname.lastname@example.org
- Updated Copyright dates (yay?)
- Added a file with examples of how to use the different filters
- Don’t specify a schema for admin_url(), let it default to ‘admin’
- firstImg() using fixed regex from dwlstng
- Using HTML-escaped tags in Underscore.js template (where appropriate)
- 2014-05-10 Dave Ross email@example.com
- Fixed a bug parsing the “display thumbnails” and “view more results” settings
- 2014-04-17 Dave Ross firstname.lastname@example.org
- Use class=”no-livesearch” to disable live search on a particular search box
- Fixed a bug saving checkboxes on the “Appearance” tab
- 2014-01-12 Dave Ross email@example.com
- Removed check for PHP 4. WordPress 3.5 is the minimum and that needs PHP 5 anyway.
- Removed caching. It wasn’t effective enough & was a support nightmare.
- Using an Underscore template to render search results
- Ukranian translation by Paul Mall (zlyton)
- Passing extra parameters to WP_Query for faster search queries
- Store “first image” in postmeta
- Query post status “publish” because admin-ajax.php runs in an admin context (oy!)
- Ignore sticky posts.
- Prevent browser autocomplete on individual input fields, not just the form
- Tested with WordPress 3.8!
- 2013-07-07 Dave Ross firstname.lastname@example.org
- Fix for “undefined offset” notice
- Fixed issue with WooCommerce’s AJAX search (only registers pre_get_posts handler when going DWLS AJAX request)
- 2013-06-05 Dave Ross email@example.com
- Added search results width to the customizer
- Faster startup on AJAX requests (fewer includes & hooks registered)
- If SCRIPT_DEBUG is set, use non-minified scripts
- Now uses a proper loop to get search results. Hopefully improves compatibility with other search plugins
- The parameters to the dwls_alter_results hook have changed: array of results (instead of a query object), deprecated (always -1), DavesWordPressLiveSearchResults instance.
- Now uses WordPress’s native submit_button() function to generate submit buttons in the admin interface for more consistent styling with the rest of admin
- Requires WordPress 3.5 or higher
- 2013-01-22 Dave Ross firstname.lastname@example.org
- Removed the “debug” tab – wasn’t very useful
- Force a high z-index on the spinner
- 2012-12-21 Dave Ross email@example.com
- Always include the “custom” css file on admin pages. Ensures customizer preview always looks right.
- 2012-12-21 Dave Ross firstname.lastname@example.org
- German (de_DE) translation
- Color picker for WP 3.5+
- 2012-11-07 Dave Ross email@example.com
- Simplified jQuery selector for older jQuery versions
- 2012-11-03 Dave Ross firstname.lastname@example.org and many awesome translators!
- Turkish (tr_TR) translation
- French (fr_FR) translation
- Dutch (nl_NL) translation
- Polish (pl_PL) translation
- Portugese (pt_PT) translation
- Improved method of getting the first thumbnail
- Canvas/VML-based spinner eliminates the need for the transparent .gif
- Italian (it_IT) translation
- Spanish (es_ES) translation
- Added hooks & filters for people to plug into DWLS
- Fixed regex parsing issue when permalinks aren’t enabled
- Support for multiple search boxes (finally!)
- You can now click anywhere in the result box to go to that result
- WP E-Commerce is officially supported again
- Toggle to enable/disable the_content filter.
- “View more results” is now translatable
- Fix to jQuery dependency definition (great catch by Robert Windisch)
- Rewrote DWLSTransients for faster performance/simplicity
- 2012-04-29 Dave Ross email@example.com
- Back-ported fix from 3.0 which sets defaults on activation
- Tested for compatibility with WordPress 3.4
- 2011-11-10 Dave Ross firstname.lastname@example.org
- Slovenian (sl_SI) translation
- Swedish (sv_SE) translation
- Various i18N fixes now that I have translations to work with
- 2011-09-15 Dave Ross email@example.com
- Fix for search results x positioning
- 2011-09-14 Dave Ross firstname.lastname@example.org
- WPML compatibility (thanks for the license!)
- Pruned some outdated code
- 2011-08-29 Dave Ross email@example.com
- Fix for i18n loading issue
- 2011-08-03 Dave Ross firstname.lastname@example.org
- Added a hook to keep Relevanssi integration out of the main code
- i18n for admin screens and user-facing text
- 2011-07-27 Dave Ross email@example.com
- Option to disable “View more results” link
- 2011-07-16 Dave Ross firstname.lastname@example.org
- Fix for Relevanssi issue
- Passing correct $capability string to admin_menu() – thanks lag47!
- Configurable excerpt length (for Alok)
- 2011-05-20 Dave Ross email@example.com
- Major code cleanup & streamlining
- Added z-index:999999 to all the default CSS files
- Removed jQuery Dimensions plugin. It’s in jQuery core > 1.2.6 & recent WP releases include jQuery 1.4
- (Hopefully) fixed IE8 hang issue (jQuery Dimensions)
- 2011-03-09 Dave Ross firstname.lastname@example.org
- Fix for determining plugin URL when WordPress is installed in a subdirectory
- Sprinkled in static declarations where needed
- Better? fix for determining plugin URL when WP Subdomains is installed
- 2011-02-28 Dave Ross email@example.com
- Pass WP_Query a parameter telling it to only return “publish” items (no drafts) — WP3.1 regression case?
- 2011-02-24 Dave Ross firstname.lastname@example.org
- Using wp_ajax actions now (deprecating my bootstrap on every AJAX call)
- Cached search results for anonymous users
- Debug tab for advanced users. Just shows cache dump for now.
- WordPress 3.1 compatibility!
- 2011-01-10 Dave Ross email@example.com
- 2011-01-09 Dave Ross firstname.lastname@example.org
- Fixed bug with Relevanssi and setting to display 0 (unlimited) posts
- Display an alert if another plugin is loading jQuery < 1.2.6
- 2010-12-04 Dave Ross email@example.com
- Search “any” content (posts, pages, custom post types)
- Better compatibility with Relevanssi plugin (worked with Mikko from that project)
- Minor jQuery performance improvements
- 2010-10-25 Dave Ross firstname.lastname@example.org
- Split options into “Settings” and “Advanced” tabs
- X Offset setting to position the results dropdown
- Include pages (as well as posts) in search results
- Raised minimum requirement to WP 2.9 (required for “Include pages” change)
- 2010-10-07 Dave Ross email@example.com
- Fixed “max results” functionality lost when implementing WP E-Commerce compatibility
- Compatibility w/servers that don’t allow getimagesize() to use URLs
- Merged in Ron Schirmacher’s code for WP E-Commerce tag & meta search
- Compatibility with WP E-Commerce when table names are used
- Fix for autocomplete suppression
- 2010-08-17 Dave Ross firstname.lastname@example.org
- Default hidden source option to 0 (search WP, not WP E-Commerce)
- 2010-08-12 Dave Ross email@example.com
- Option to not include any additional CSS file (thanks Andy Hall!)
- Support for xLanguage plugin
- Support for searching WP E-Commerce products
- Replaced clearfix that was somehow lost
- 2010-07-03 Dave Ross firstname.lastname@example.org
- z-index:9999 for cadbloke to keep search results above all other content (that doesn’t already have a z-index of 9999 or higher)
- Hidden results display when resizing window https://wordpress.org/support/topic/410612
- 2010-05-02 Dave Ross email@example.com
- Fixed changelog formatting
- Reposition the search results popup when the window is resized
- 2010-03-23 Dave Ross firstname.lastname@example.org
- Now compatible with WP-Subdomains plugin
- Format dates using WordPress date setting
- Added MIT license text to daves-wordpress-live-search.js.php and daves-wordpress-live-search-bootstrap.php files
- 2010-02-24 Dave Ross email@example.com
- Support for wp-config.php outside main WordPress directory (2.6+)
- Fix to make “view more results” link work on pages other than home
- Fix path to stylesheet directory
- Fix compatibility with child themes
- 2010-02-14 Dave Ross firstname.lastname@example.org
- Added option for minimum number of characters that need to be entered before triggering a search
- More graceful failure message in PHP4
- Added code to ignore E_STRICT warnings when E_STRICT enabled on PHP 5.3
- Possible fix for compatibility with Relevanssi plugin (some concern this isn’t working yet)
- Fix for compatibility with child themes
- Added MIT license to DavesWordPressLiveSearch.php class
- 2009-12-02 Dave Ross email@example.com
- Tested compatibility with WordPress 2.3-2.9 beta 2
- Fixed stylesheet issue with WordPress 2.5.x
- Set minimum WordPress version to 2.6. Admin page doesn’t appear in 2.5.
- Added support for WordPress 2.9 “post thumbnails”
- Put autocomplete=”off” on the form instead of the search box (fix for Firefox issue?)
- Use “Display Name” instead of “username”
- Added page exception list
- Live search no longer tries to add itself to admin pages
- 2009-10-25 Dave Ross firstname.lastname@example.org
- Added note about WP-Minify
- Tested with WordPress 2.8.5
- Security – nonce checking on admin screen
- Security – check “manage_options” security setting
- Notes on configuration in readme.txt
- 2009-08-27 Dave Ross email@example.com
- Thumbnails in the search results
- Excerpts in the search results
- 2009-08-17 Dave Ross firstname.lastname@example.org
- Implemented selectable CSS files
- Fixed a bug that broke live searches containing ‘ characters
- 2009-07-08 Dave Ross email@example.com
- Fixed compatibility with Search Everything plugin, possibly others
- 2009-06-03 Dave Ross firstname.lastname@example.org
- Renamed release 1.3.1 to 1.4 because WordPress.org doesn’t seem to like 1.3.1. Seems like kind of a waste to do a full point release for this
- Building permalinks instead of using post guid (problem with posts imported from another blog)
- 2009-05-22 Dave Ross email@example.com
- Fixed an annoying bug where the search results div collapsed and expanded again every time an AJAX request completed
- Cancel any existing AJAX requests before sending a new one
- Check for PHP 5.x. Displays an error when you try to activate the plugin on PHP < 5
- No longer sends the entire WP_Query object to the browser. This was a potential information disclosure issue, plus it was a lot to serialize on the server and parse in the brower
- Minor code cleanup & optimizations
- 2009-04-10 Dave Ross firstname.lastname@example.org
- Code cleanup & optimizations
- Styled the admin screen to fit in with WordPress better
- New option: display the results above or below the search box
- Included a note on the admin screen recommending the Google Libraries plugin
- 2009-03-30 Dave Ross email@example.com
- Code cleanup & optimizations
- Fixed compatibility issues with PHP < 5.2.0 and PHP < 5.1.2
- New option: limit the number of results to display
- 2009-03-13 Dave Ross firstname.lastname@example.org
- Initial release