-
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?
-
Alvind
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!
-
Alvind
We’re going to add this to the docs site along with other useful filter hooks.
- You must be logged in to reply to this topic.