Continue reading Restricting posts in the index

Restricting posts in the index

The relevanssi_indexing_restriction filter hook is often the best way to restrict what goes in the Relevanssi index and what not. There’s also relevanssi_do_not_index, which is also a fine way to approach this and is often easier to apply when you’re talking about blocking individual posts, but for larger exclusions, relevanssi_indexing_restriction is better. Extensive use of…

Read more Restricting posts in the index 0 Comment on Restricting posts in the index
Continue reading Excluding old content from the search

Excluding old content from the search

Is there a way to exclude anything before 2016 from search results? Yes. There are two approaches to this. If you never want to see anything old in the results, it’s best to filter in indexing. Add this to your theme functions.php. If, on the other hand, you only want to apply this filter in…

Read more Excluding old content from the search 0 Comment on Excluding old content from the search
Continue reading Events Calendar: Remove past events from search

Events Calendar: Remove past events from search

If you have events on your site, you might not want to show the past events in the search. This is easy to do with Relevanssi. It can be done in two ways: either you block the past events in indexing or in searching. In most cases, the best solution is to do both. Blocking…

Read more Events Calendar: Remove past events from search 2 Comments on Events Calendar: Remove past events from search
Continue reading WooCommerce: Hidden products in search

WooCommerce: Hidden products in search

Relevanssi by default shows out-of-stock and excluded from catalog WooCommerce products in the search results, but hides those set to excluded from search (before 2.2.2 and 4.1.2 the default behaviour was to show all products). It is quite easy to make Relevanssi not to display hidden products in the results. The best way is to…

Read more WooCommerce: Hidden products in search 21 Comments on WooCommerce: Hidden products in search
Continue reading Controlling attachment types in index

Controlling attachment types in index

Relevanssi lets you index attachments – not their contents, but the names and descriptions. But perhaps you only want to index a particular type of attachment? Relevanssi settings don’t have any control over that, it’s either all attachments or nothing. It is possible to choose which kinds of attachments are indexed. It is done with the…

Read more Controlling attachment types in index 14 Comments on Controlling attachment types in index
Continue reading Excluding posts by taxonomy

Excluding posts by taxonomy

Relevanssi has a category exclusion feature built in, but that only works for basic categories and not any other taxonomies. You can use tax_query to restrict the searches as well, but that’s more complicated than adjusting the setting in Relevanssi settings. However, if the exclusion is permanent, it’s best done in the indexing level. That…

Read more Excluding posts by taxonomy 20 Comments on Excluding posts by taxonomy
Continue reading Excluding protected posts

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…

Read more Excluding protected posts 14 Comments on Excluding protected posts