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



Plugin compatibility

Theme compatibility

Adding a custom field filter in the search

Adding a custom field filter in a Relevanssi search takes a little bit of programming, because the filter needs to create a meta_query that Relevanssi understands. Let’s assume we have some colour information in a custom field that’s called colour_field, and we want to use that to filter the search results. First, let’s add a […]

Allowing decimal numbers

Relevanssi by default does not support decimal numbers. The decimal points are handled as punctuation and removed. If you want to keep decimal numbers together and make them available in the search, you can add this code to your theme functions.php: add_filter(’relevanssi_remove_punctuation’, ‘rlv_keep_decimals’, 9); function rlv_keep_decimals($a) { $a = preg_replace(’/(\d)\./’, ‘\1PERIOD’, $a); return $a; } […]

WooCommerce popularity and price sorting

Many WooCommerce users use search sorting that allows users to sort by popularity or price. Unfortunately while Relevanssi works fine with WooCommerce, those sorts do not work. Relevanssi doesn’t know about price or popularity, and the sorting assumes there’s default WP search underneath. Relevanssi doesn’t do meta field sorting as easily as the default WP […]

Put sticky posts first in results

If you want to have sticky posts first in results when they match the search query, just add this code to your theme functions.php: add_filter( ‘relevanssi_hits_filter’, ‘rlv_sticky_first’ ); function rlv_sticky_first( $hits ) { $sticky = array(); $nonsticky = array(); $sticky_post_ids = get_option( ‘sticky_posts’ ); foreach( $hits[0] as $hit ) { if ( in_array( $hit->ID, $sticky_post_ids […]

Relevanssi and Genesis

In some cases Relevanssi requires modifications to search result template for the search results to work properly (in particular when using Relevanssi Premium to search user profiles and taxonomy terms). Adjusting the templates is really simple, usually just changing the_permalink() to echo relevanssi_get_permalink() is enough, but framework themes like Genesis make small changes like these […]