I am currently working on na project which requires a modification to wordpress search functionality.

I would like to modify it in this manner

  • to make wordpress search only page titles.
  • to make search bar auto suggest page titles when a user begins to type on the search bar textfield.
  • once a matching page title is selected by user from the autosuggest drop down and searched, the corresponding page is loaded and not wordpress search result page.
  • possibility of also displaying most frequently searched pages in Autosuggest drop down.

I have been able to find a code snippet for functions.php file to limit search to page titles.

I have also setup elastic search and installed elastic press plugin for the site. Wanted to use this for autosuggest functionality and other features I might implement in future.

That is the much i have done. I really need help with the last two features i listed.

Much help will be highly appreciated. Thanks.

  • If you're using ElasticSearch and ElasticPress, then it's not WordPress' search you want to modify. When using those they take over the search functionality, so anything you want to change would need to be done to those. Since 3rd-party plugins and services are off-topic here, I'd suggest contacting the plugins' authors for help. – Jacob Peattie Jun 17 at 13:14
  • @JacobPeattie please do you mind sharing how i could do this without those plugins. I followed the elastic press path because i thought it was how to go about this. Thanks – spynoble Jun 18 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.