• With Twenty Twenty-Two as active theme, no search results are shown while Relevanssi is active. Results do show by switching themes or disabling Relevanssi. Relevanssi is the only active plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    I can confirm this: Relevanssi does a search and finds results, but Twenty Twenty-Two does not display them. I’ll need to study what does it do with the results and where does it expect the results to come from.

    Plugin Author Mikko Saari

    (@msaari)

    And actually, I already had a solution for this in the Relevanssi Knowledge base.

    “There’s something of a compatibility issue between Relevanssi and Gutenberg Full Site Editing. No results are found when you create a Query Loop to display the search results with Relevanssi enabled. The blank results happen because the post template block doesn’t use the Relevanssi results but instead uses a new WP_Query. Since Relevanssi still blocks the default search, this comes up empty.

    For a straightforward solution, add this to your theme functions.php:

    add_filter( 'relevanssi_search_ok', function( $ok, $query ) {
      if ( ! empty( $query->query_vars['s'] ) ) {
        $ok = true;
      }
      return $ok;
    }, 10, 2 );

    ?
    This function hooks to the relevanssi_search_ok filter hook. This hook fires because Relevanssi looks at the newly-created WP_Query, but since it’s not the main query for the template, Relevanssi doesn’t take over. This function instructs Relevanssi to take over as long as there’s a s parameter in the query and a search term exists.”

    Thread Starter swinggraphics

    (@swinggraphics)

    Thanks! It’ll probably be another year while FSE matures before I use it in production. Glad this issue is on the radar, though.

    Hi Mikko!

    Thank you for sharing the workaround. Is the issue something that should be addressed in the Twenty Twenty-Two theme itself? If so, do you know if this has been reported somewhere? Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘No results shown in Twenty Twenty-Two’ is closed to new replies.