dailce
February 13, 2025, 8:54pm
1
I’m using the search filter with the following details:
On my site I have a simple search form:
<form method="get" class="form-search" action="/page1/">
<input type="search" class="search-field" placeholder="Search Products" name="_product_search">
<button class="search-submit" type="submit">Submit</button>
</form>
It almost works, when I submit the search, it directs to the correct page the URL is
.com/page/?_product_search=test
But it doesn’ show any results, if I manually press ENTER on the url of the browser then _product_search does take NOT effect either!
Is this a bug or am I missing something here?
EDIT: Here is a screenshot, I have the proper url but the result show:
If I enter “test” via the filter the proper result shows.
EDIT UPDATE: I disabled Relevanssi Search and it’s now ok, but I need to have Relevanssi ACTIVE. Please advise.
Thanks.
1 Like
dailce
February 14, 2025, 2:03am
2
I did testing. If I keep my bricks URL search parameter as “s” it works. but the bricks options says “Define a unique, more readable URL parameter name for this filter.” I’m not sure is there a way to define a unique bricks parameter here and then do I try to update the “s” in WP? Or is there some other filter that can be used?
Hi @dailce ,
Based on your screenshot, the parameter is taking effect and so the search input and active filter showing “test”
If the query is not having a result, please check if you have any third-party filter plugin installed that could conflict with Bricks.
Otherwise, please send admin credentials to help@bricksbuilder.io (Include this thread URL as reference) so we can check.
Regards,
Jenn
dailce
February 14, 2025, 12:19pm
4
Relevanssi Search seems to be hijacking the search query, the workaround is to use “s” as the search parameter, which isn’t ideal I don’t think…
dailce
February 14, 2025, 1:41pm
5
I FOUND A FIX: this will allow you to continue to use the Brickbuilder filter, and prevent Relevanssi from taking over:
add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
if ( $element_id === '56f380' ) { //the brick query loop element
remove_filter( 'posts_request', 'relevanssi_prevent_default_request' ); //interferese with bricks search filter parameter
//remove_filter( 'posts_pre_query', 'relevanssi_query', 99 );
add_filter( 'relevanssi_orderby', function( $orderby ) { return 'menu_order'; } ); //should match bricks query menu order
add_filter( 'relevanssi_order', function( $order ) { return 'asc'; } );
$query_vars['relevanssi'] = true; //APPLY relevanssi to the bricks ajax search see: https://www.relevanssi.com/user-manual/using-relevanssi-outside-search-pages/
//print( '<pre>' . print_r( $query_vars, true ) . '</pre>' );
}
return $query_vars;
}, 10, 3 );