Browser: Chrome 110 OS: macOS / Windows / Linux / etc. URL: Link to a page that illustrates this issue Video: Short screen recording that illustrates this issue (free tool: jam.dev)
[Please describe this bug in as much detail as possible so we can replicate & debug this bug]
Hello Bricks Team,
I’m facing an urgent issue with Live Search on Bricks Builder (v1.10.x). I need the search to work only on one ACF field (dranun) and completely disable the default WordPress s= parameter to avoid searching in post_title and post_content.
I’ve tried overriding the query using both pre_get_posts and bricks/query/run hooks (code below), but the s= parameter is still present in the AJAX request (s=մաշ), causing unwanted results (e.g., searching for “մաշ” returns all dermatologists because of the specialty field in post_content).
As you are using a very old version, we can’t directly give you a correct suggestion because the latest query filters logic is not the same as in 1.10.x
Your code will not work because in Bricks Filter AJAX endpoint, the filter values were submitted via POST request and the data was wrapped inside different array keys. (Please inspect via Dev tools)
I would suggest you use this hook to amend the posts query_vars instead.
bricks/posts/query_vars
By using this hook, with higher priority like 50, you can error_log the $query_vars to check the search value + add your custom meta_query.
Thank you for your guidance! I’ve implemented the bricks/posts/query_vars hook as suggested and used a higher priority (999). I also checked the POST request in Dev Tools and found that the search value is sent as selectedFilters[sreabl]. My updated code now correctly retrieves the search term, but the s= parameter is still present in the AJAX response, causing unwanted results.
For example, when I search for “derm” (which is not in the dranun field), it still returns all dermatologists because of the specialty field in post_content. Here’s my updated code:
Despite this, the s= parameter is still affecting the search. How can I completely disable s= in Live Search to ensure it only searches in the dranun field? I’d really appreciate your help!
Otherwise, please provide admin credentials and all details (location of your code, actual URL of the page etc) to help@bricksbuilder.io so I can take a look.
I wanted to share an update on my issue with Live Search in Bricks Builder. Thanks to the amazing support from the Bricks community, especially Jenn Lee, we found a solution!
The Solution:
To make Live Search work only on specific ACF fields (e.g., field_1, field_2) and avoid searching in post_title or post_content, you can use the bricks/posts/query_vars filter to unset the s= parameter and apply a Meta Query. Here’s a simplified example: