Posted on

GeneratePress: Query Loop

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 this to your site:

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.

Leave a Reply

Are you a Relevanssi Premium customer looking for support? Please use the Premium support form.

Your email address will not be published. Required fields are marked *