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?

This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37999
    leroile
    leroile
    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?

    Attachments:
    You must be logged in to view attached files.
    #38002
    leroile
    leroile
    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 Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

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

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.