This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

How to change the default search bar value?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to change the default search bar value?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37999
    leroileleroile
    Participant

    I was wondering if there was a filter or parameter to change the default value of the search bar:

    <input type=”search” name=”phrase” value=”MODIFY DEFAULT SEARCH VALUE”>

    I see that this functionality is already implemented. Whenever there is a ?s= the default value of the search bar is changed to that parameter (screenshot).

    I need to change the default value to something custom using PHP, is that possible?

    #38002
    leroileleroile
    Participant

    Ok I have found how to do it on my own.

    For people interested, to change the default value of the search bar, it is the following code:

    add_filter(“asp_print_search_query”, “asp_change_print_search_query”, 10, 2);
    function asp_change_print_search_query($query, $search_id) {
    // Edit query (string that is the default value)
    return $query;
    }

    #38010
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Yes, that is actually the code we also advise, very good job. Here is a reference knowledge base.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.