Continue reading Year filter from the search query

Year filter from the search query

A good question was asked in the post Natural-language date queries: Is it possible to extend this so that I can simply add a the year in the search and only results from that year would show? The answer is yes! Add these functions to your site: The code consists of two functions. The first…

Read more Year filter from the search query 0 Comment on Year filter from the search query
Continue reading Automatic redirects to category archives

Automatic redirects to category archives

While Relevanssi Premium can return taxonomy terms as search results, sometimes sending the searcher directly to the category archive is better. This is especially true for WooCommerce sites, where displaying taxonomy terms in search results pages is complicated. Relevanssi Premium has a redirect feature you can use to redirect searches to specific pages. This is…

Read more Automatic redirects to category archives 0 Comment on Automatic redirects to category archives
Continue reading Integrating Koko Analytics stats

Integrating Koko Analytics stats

It’s possible to integrate all kinds of external data to Relevanssi weights. Koko Analytics is a great analytics plugin. It collects stats about your visitors and stores them in the local database, which means those stats are available for Relevanssi. For some sites, this makes a lot of sense. For example, I have Kirjavinkit, a…

Read more Integrating Koko Analytics stats 0 Comment on Integrating Koko Analytics stats
Continue reading Using Relevanssi in wp_link_query

Using Relevanssi in wp_link_query

If you want to use Relevanssi in the link queries (the search you get when adding links to posts in Classic editor), that’s easy. Make sure Relevanssi is enabled in admin searches, and then add this function: This function will make the Classic Editor link queries use Relevanssi. This approach generally works fine, but if…

Read more Using Relevanssi in wp_link_query 0 Comment on Using Relevanssi in wp_link_query
Continue reading Redirecting email searches to the login page

Redirecting email searches to the login page

A client asked for a solution to redirect all searches for email addresses to the login page – perhaps someone is constantly using the search field when they’re actually looking for the login. This can be achieved with the Redirects tool, as it takes regular expressions. You can also add this to your site: This function…

Read more Redirecting email searches to the login page 0 Comment on Redirecting email searches to the login page
Continue reading Support for ^ and $ anchoring operators

Support for ^ and $ anchoring operators

In regular expressions, ^ can be used to match the beginning of the line and $ to match the end of the line. For example, ^ban will match banana, but not urban, while ban$ matches urban, but not banana. These are called anchoring operators. By default, Relevanssi matches either beginning or the end of the…

Read more Support for ^ and $ anchoring operators 0 Comment on Support for ^ and $ anchoring operators
Continue reading Adding direct links to outside pages to search results

Adding direct links to outside pages to search results

Hi, is there a way to add a link to another website when searching for certain keywords? We have a few affiliates and we want to include a direct link to their websites in the search results when certain terms are searched for. How would I go about this? A straight-forward approach for this is…

Read more Adding direct links to outside pages to search results 0 Comment on Adding direct links to outside pages to search results
Continue reading Relevanssi breaks autoembeds on result pages

Relevanssi breaks autoembeds on result pages

You may notice that enabling Relevanssi custom excerpts breaks all autoembeds (things like Youtube video embeds) on search results pages. That’s done on purpose, because the autodiscovery of those embeds can be a proper performance killer if the search results include lots of embedded content. Thus, Relevanssi switches the feature off, considering it’s not commonly…

Read more Relevanssi breaks autoembeds on result pages 0 Comment on Relevanssi breaks autoembeds on result pages
Continue reading Moving the admin search page

Moving the admin search page

Jules Colle came up with a method of moving the Relevanssi admin search page from under the Dashboard heading to the top level of the admin menu. This function adds an admin_menu action that first uses remove_submenu_page() to remove the existing admin search function and then add_menu_page() to add it again on the top menu…

Read more Moving the admin search page 0 Comment on Moving the admin search page
Continue reading Forced phrase search with fallback

Forced phrase search with fallback

Relevanssi by default does not consider the search query a phrase, or value posts where the words in the search query appear together. Sometimes people do expect that, especially in AND searches. Relevanssi however does not have the information about the nearby words, so it’s not possible for Relevanssi to factor that in. Relevanssi does…

Read more Forced phrase search with fallback 0 Comment on Forced phrase search with fallback