Turn off Live Search

This support request was posted in Flatbase by nyceco

Request ID #4828 Resolved
  • Hi – I’d like to turn off the Live Search functionality since it searches on every letter entered. I keep track of my users’ search terms, so after searching for “apple,” my report counts the following as search terms:

    ap
    app
    appl
    apple

    I still want to use the main search box on the front page. I just need to turn off the automatic searching. Thanks!

    Hi,

    Thanks for writing and hoping that you are doing well today.

    Well, there’s an option within the theme options in order to disable the live search. I understand that you want to maintain the search form but avoid having the live search functionality. Unfortunately that can’t be done through the theme options and the only way to achieve that would be customizing the javascript file which triggers the live search functionality. It is not the best way to go, but it should work. The file is in /includes/js/general.js

    Best,
    Juan

    Hi Juan,

    Thanks for the information. In the general.js file I see a section that talks about the Livesearch label, but customizing that only affects whether the pre-filled text, “Have a question? Ask or enter a search term,” changes as the user enters text. Upon entering text, the search box still does the auto-search.

    I’m not a JS pro by any means, so maybe I’m missing it.

    I disabled Live Search by commenting out the appropriate register and enqueue script lines in scripts.php. I hope I didn’t break anything else!

    Juanfra Aldasoro

    Hi there,

    Thanks for your prompt response. Yes, you are right, you can do it that way.

    Remember to comment this line as well:

    add_action( 'wp_head', 'nice_livesearch_js', 10 );
    

    That function is the one in charge of initializing the javascript library. If you only comment the enqueue functions then, that action will be trying to initialize the javascript without the library and you’ll get an error.

    Best,
    Juan.

    Thanks, Juan. I commented out the add_action and it seems like everything is working okay.

    Juanfra Aldasoro

    No problem 🙂

    Have a nice day,
    Juan.

Viewing 7 posts - 1 through 7 (of 7 total)

This topic is marked as resolved

Only the topic author can re-open this thread.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server