Relevanssi doesn’t work automatically with the Query Loop block in GeneratePress and GenerateBlocks. Fortunately, the solution is simple: the Query Loop block has a filter hook for adjusting the query parameters, and you can use that filter hook to enable Relevanssi.
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
if (! is_admin() && ! empty( $query_args['s'] ) ) {
$query_args['relevanssi'] = true;
}
return $query_args;
}, 10, 2 );Thanks to Ben Knowles.
If you are using V2 Query Block, the correct snippet is this:
add_filter( 'generateblocks_query_wp_query_args', function( $query_args, $attributes ) {
if (! is_admin() && ! empty( $query_args['s'] ) ) {
$query_args['relevanssi'] = true;
}
return $query_args;
}, 10, 2 );Source: Generate support.