This topic contains 2 replies, has 2 voices, and was last updated by Ernest Marcinko 9 months, 2 weeks ago.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
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 9 months, 2 weeks ago.
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?
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;
}
Hi,
Yes, that is actually the code we also advise, very good job. Here is a reference knowledge base.
Best,You must be logged in to reply to this topic.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |