Skip to main contentSkip to footer

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.

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.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

German umlauts
By default, the search ignores German umlauts. Searching for “uber” will also find “über” and so on. This ignorance is…
bbPress: Private Groups support
Private Groups is a plugin that makes bbPress forum groups private. Relevanssi, however, doesn’t understand that privacy and will show…
Index custom field contents
Custom fields (also known as post meta or meta fields) are a major part of WordPress the default search won’t…

Related Posts:

Comment Section:

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed