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

Indexing custom post statuses

If you’re using custom post statuses, Relevanssi requires some tinkering. By default, Relevanssi only handles posts that are of status publish, pending, draft or private. Relevanssi has a filter that lets you add more statuses to the list of acceptable statuses for Relevanssi: function rlv_add_status($status_array) { $status_array[] = "new_status"; return $status_array; } add_filter(’relevanssi_valid_status’, ‘rlv_add_status’); add_filter(’relevanssi_valid_admin_status’, […]

Yoast Local SEO compatibility issues

Yoast Local SEO plugin breaks Relevanssi search. It enhances the search by adding meta queries. Unfortunately they don’t work with Relevanssi. The fix is simple, though: add_filter(’relevanssi_modify_wp_query’, ‘rlv_meta_fix’, 99); function rlv_meta_fix($q) { $q->set(’meta_query’, ”); return $q; } This clears out the meta_query.

Membermouse support for Relevanssi

If you’re using MemberMouse to manage memberships on your site, having Relevanssi co-operate with MemberMouse is easy. Just add the following code to your theme functions.php and your protected content will not be displayed to users without access to the content: add_filter(’relevanssi_post_ok’, ‘membermouse_relevanssi_ok’, 20, 2); function membermouse_relevanssi_ok($post_ok, $doc) { if (function_exists(’mm_access_decision’)) { $post_ok = mm_access_decision(array("id"=>$doc, […]

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 […]