Continue reading Restricting the indexing to particular user roles

Restricting the indexing to particular user roles

From the Relevanssi settings, you can only choose whether subscribers are indexed or not. If you need finer control over what user roles are indexed by Relevanssi, you can use the relevanssi_user_index_ok filter hook with the following code. Place it in your theme functions.php: Just adjust the $block_these_roles array to include the roles you want…

Read more Restricting the indexing to particular user roles 0 Comment on Restricting the indexing to particular user roles
Continue reading Utf8mb4 charset and index problems

Utf8mb4 charset and index problems

If you use utf8mb4 charset, Relevanssi database table may be missing an index. That’s because part of the index includes a column type that is of varchar(210) type. This is fine with utf8, but fails for utf8mb4, which only allows columns 191 characters long (because maximum column size is 767 bytes, and for 4-byte utf8mb4…

Read more Utf8mb4 charset and index problems 0 Comment on Utf8mb4 charset and index problems
Continue reading Indexing custom post statuses

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. Add this to your site: This function, added to the two filters,…

Read more Indexing custom post statuses 4 Comments on Indexing custom post statuses
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
Continue reading Indexing attachment file names

Indexing attachment file names

Relevanssi has been working nicely for the normal usecase. But how does one setup indexing of attachment files. When someone searches by a file name or an extension like pdf, there are no results. I have enabled ‘attachment’ at Relevanssi ‘Indexing options’ and still there are no results. Relevanssi doesn’t index attachment file names. For…

Read more Indexing attachment file names 7 Comments on Indexing attachment file names
Continue reading Indexing the post ID

Indexing the post ID

Are post ID’s searchable in Relevanssi? No. Relevanssi does understand the WP_Query p parameter to restrict the search by post ID. However, if you want to search by post ID, it’s very simple to make that happen using the relevanssi_content_to_index filter hook: Add that to theme functions.php, reindex and searching for post ID’s works. Originally…

Read more Indexing the post ID 2 Comments on Indexing the post ID
Continue reading How to index parent categories

How to index parent categories

Suppose you have a parent category with no products in it but a child category does. If you search by the parent category can relevanssi be set up to show the products in the child category? Cars > Wiper Blades. A search for cars shows wiper blade products. By default this does not work, because…

Read more How to index parent categories 3 Comments on How to index parent categories