Category Archives: Knowledge Base

Knowledge base contains information on how to use Relevanssi. There are lots of features that are documented in the knowledge base. Here’s an index to the knowledge base, with all the entries sorted under different topics.

The most important troubleshooting trick

Advanced hacking, filter hooks

Search results pages

Search more



Theme compatibility

Compatibility with the Avada theme

Avada is the most popular WordPress theme on the market. Unfortunately it doesn’t work with Relevanssi out of the box. The reason for the incompatibility is the most common there is: there’s an unnecessary query_posts() call in the search.php file. To make Relevanssi work, make the following change to the search.php file. Find this line: […]

Auto-redirecting with one search result

If you want to auto-direct the user directly to the result if there’s just one result for the search, that’s quite easy. Just add the following code to your theme functions.php: add_action(’template_redirect’, ‘one_match_redirect’); function one_match_redirect() { if (is_search()) { global $wp_query; if ($wp_query->post_count == 1) { wp_redirect( get_permalink( $wp_query->posts[’0’]->ID ) ); } } } This […]

Excluding protected posts

A site I’m working with has a handful of “protected” posts (password required to view). For various reasons, we don’t want to show these in search results. While there is no excerpt shown, I’d prefer for people to not even know they exist. Relevanssi sees protected posts as public posts (because their post status is […]

Indexing attachment filenames

Relevanssi has been working nicely for the normal usecase. But how does one setup indexing of attachment files. When someone searches by filename or extension like pdf, there are no results. I have enabled ‘attachment’ at Relevanssi ‘Indexing options’ and still there are no results. Relevanssi doesn’t index attachment file names. For attachments, Relevanssi indexes […]

Different fuzzy search setting on different searches

On one of our sites we have 2 search boxes, one where you can do a normal search and the other where you can search for employees or departments. The employees/department search is done by using the relevanssi_do_query() function. Can we use fuzzy matching on the normal search and disable it on the employees/department search? […]

Searching by post ID

Are post ID’s searchable in Relevanssi? No. Relevanssi does understand the WP_Query p parameter to restrict the search by post ID. However, if you want to search by post ID, it’s very simple to make that happen: add_filter(’relevanssi_content_to_index’, ‘rlv_index_post_id’, 10, 2); function rlv_index_post_id($content, $post) { $content .= " " . $post->ID; return $content; } Add […]