apply_filters( 'relevanssi_didyoumean_suggestion', string $suggestion )

Filters the complete Did you mean suggestion.


(string) The complete suggestion HTML code.

More information

This is the final filter hook in the Did you mean process, in both free and Premium. This hook filters the complete HTML code of the suggestion:

<p>Did you mean: <a href="http://loyang.local?s=lore">lore</a></p>

If there are any adjustments required for the HTML element, this is the right place for them. For example to add a class to the link, you could do:

add_filter( 'relevanssi_didyoumean_suggestion', 'rlv_add_some_class' );
function rlv_add_some_class( $suggestion ) {
  return str_replace( '<a ', '<a class="dym_suggest" ', $suggestion );

If you just want to adjust the URL, it’s easier to use relevanssi_didyoumean_url.