Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

GB 2.0 Query Loop & Relevanssi compatibility

  • boxcar-studio

    We’re working on a custom search results page with the following components:

    • Element – Loop Template – this has our Query Loop block in it, set to “Inherit query from template”
    • Relevanssi Premium installed and activated
    • This snippet Relevanssi provided for compatibility with your query loop block

    However, when using the search, we don’t get any results when there should be dozens for a basic word like “the”. Other examples shared in the Private Information.

    While debugging, we can deactivate Relevanssi and your query loop works, but we lose out on the extra indexing we want. And if we turn off the Loop Template element, it works as well, so we know that Relevanssi is indexed and we can see results in the theme’s default loop.

    Can you help me understand if the snippet Relevanssi provided in their documentation needs to be updated or if there’s another means of making GB2.0 Query Loop compatible with it?

  • Hi there,

    The snippet is using a filter that works only in the V1 Query Loop. You can try this instead for the V2 Query Block:

    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 );
  • boxcar-studio

    Fantastic! I figured it was something like that but I couldn’t find it in the documentation!

  • We’re going to add this to the docs site along with other useful filter hooks.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.