Wordpress Ajax Search & Autosuggest Plugin Updated Jun 2026
return new WP_REST_Response( $results, 200 );
Create a file named search.js inside your plugin folder. This script handles the input event, the fetch request, and the rendering of the dropdown. wordpress ajax search & autosuggest plugin
.wp-ajax-search-results a:hover background: #f9f9f9; return new WP_REST_Response( $results, 200 ); Create a
Back in the main PHP file, we need to load the JavaScript, localize the REST URL (so we don't hardcode it), and provide the HTML wrapper. return new WP_REST_Response( $results
Predictive Search Results with Ajax Search Pro for WordPress