Continue reading How to block searches without a search term

How to block searches without a search term

By default, Relevanssi returns all posts when searching without a search term. That’s the default WordPress behaviour. Sometimes it may not be the wanted behaviour. One reason is performance: returning all results can be very slow. To stop Relevanssi from running when there’s no search term, add this to your site: This little function will…

Read more How to block searches without a search term 2 Comments on How to block searches without a search term
Continue reading Gutenberg Full Site Editing

Gutenberg Full Site Editing

There’s 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…

Read more Gutenberg Full Site Editing 2 Comments on Gutenberg Full Site Editing
Continue reading Premium 2.1.1 / Free 4.0.5

Premium 2.1.1 / Free 4.0.5

Thanks to a very eye-opening talk in WordCamp Jyväskylä earlier this year by Otto Kekäläinen from Seravo, Relevanssi code has been reviewed and modified to follow WordPress coding standards. As a result, there have been minor improvements all around the code to make things more robust and secure. Every new Relevanssi Premium release is now…

Read more Premium 2.1.1 / Free 4.0.5 0 Comment on Premium 2.1.1 / Free 4.0.5
Continue reading Free 3.0

Free 3.0

…$wp_query before it is passed to Relevanssi. New filter: relevanssi_search_ok lets you adjust when search is enabled. New filter: relevanssi_pre_excerpt_content lets you adjust post content before excerpt creation. New filter: relevanssi_excerpt_content lets you adjust post content before excerpt creation, but after the_content. New filter: relevanssi_ellipsis lets you change the default……‘…’ in excerpts to something else. New filter: relevanssi_do_not_index is given a post ID and expects a boolean in return: should this post be indexed or not? New filter: relevanssi_match lets you meddle with the matching engine. New filter: relevanssi_results filters the result set from the search. New filter: relevanssi_content_to_index……need Relevanssi Premium, which does it better anyway. Relevanssi can handle certain whitespace characters better in indexing. Apostrophes are now replaced with whitespace instead of being removed. Relevanssi now shows correct number of results when posts_per_page is set to -1. Fuzzy search didn’t always activate when it should, if all…

Read more Free 3.0 32 Comments on Free 3.0
Continue reading Using Relevanssi without a search term

Using Relevanssi without a search term

…a search term present. This was originally implemented for a restaurant search, where the users can search for restaurants based on search terms, opening hours and price category. The client wished to be able to use the opening hours and price category with and without a search term. The problem……is, Relevanssi doesn’t trigger without a search term. To fix that, you need to use a new filter hook relevanssi_search_ok. Add this code to your site: add_filter( ‘relevanssi_search_ok’, ‘search_trigger’ ); function search_trigger( $search_ok ) { global $wp_query; if ( ! empty( $wp_query->query_vars[ ‘price‘ ] ) ) { $search_ok = true;……} return $search_ok; } This function will trigger Relevanssi, when the query var price appears in the query. Of course, without a search term, Relevanssi will find nothing. So, you need another function attached to relevanssi_hits_filter. It needs to have something like this: add_filter( ‘relevanssi_hits_filter’, ‘rlv_hits_filter’ ); function rlv_hits_filter( $hits…

Read more Using Relevanssi without a search term 42 Comments on Using Relevanssi without a search term