Continue reading Relevanssi indexes excluded posts

Relevanssi indexes excluded posts

Sometimes it can happen the search results include posts from a post type that has been excluded from the index. When that happens, here are things you can check. Are you using Relevanssi? It’s possible your search results are not coming from Relevanssi. The quickest way to check is to use the Relevanssi admin search…

Read more Relevanssi indexes excluded posts 0 Comment on Relevanssi indexes excluded posts
Continue reading Indexing product codes with and without spaces

Indexing product codes with and without spaces

A Relevanssi Premium customer had a problem with product codes. The codes are in the format “ABC 100”, that is a group of letters and a group of digits with a space in between. Users may search for the codes without the space, so the post should be found with either “ABC 100” or “ABC100”.…

Read more Indexing product codes with and without spaces 3 Comments on Indexing product codes with and without spaces
Continue reading Debugging indexing problems

Debugging indexing problems

The easiest way to debug indexing problems is to use the WP CLI tools available in Relevanssi Premium. To see how Relevanssi sees the post 123, just use the following command on the command line: This will print out how Relevanssi sees the post, how it appears in the different steps of the indexing process…

Read more Debugging indexing problems 0 Comment on Debugging indexing problems
Continue reading Indexing image captions for the posts

Indexing image captions for the posts

The use case is I run several newspapers, and the “caption” field when uploading media is where the journalists put the photographer credit. We need to be able to index the photographer bylines, but ideally would want to return the story/commentary where their image was used, not the image itself. If you want to index…

Read more Indexing image captions for the posts 0 Comment on Indexing image captions for the posts
Continue reading Blocking pre and code tags

Blocking pre and code tags

If your posts have lots of programming code examples in <pre> and <code> tags, those might look pretty bad in the search results. A snippet of programming code isn’t usually a good excerpt, and if you use those tags purely for code snippets, they won’t likely contain significant search content, either. Fortunately it’s easy to…

Read more Blocking pre and code tags 0 Comment on Blocking pre and code tags
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 following code. Place it in your theme functions.php: add_filter(’relevanssi_user_index_ok’, ‘rlv_do_not_index_admins’, 10, 2); function rlv_do_not_index_admins($do_index, $user) { $block_these_roles = array(’administrator’, ‘editor’, ‘author’, ‘contributor’, ‘subscriber’);  …

Read more Restricting the indexing to particular user roles 0 Comment on Restricting the indexing to particular user roles
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 Deindexing Yoast SEO noindex posts

Deindexing Yoast SEO noindex posts

Update: This is now Relevanssi default behaviour, starting from Premium 2.3.0 and Free 4.3.1. For disabling this feature, see Yoast SEO compatibility. If you use Yoast SEO to mark posts “noindex”, you may want to have Relevanssi deindex those posts as well. It’s easy to do using the relevanssi_do_not_index hook. Just add this function to…

Read more Deindexing Yoast SEO noindex posts 1 Comment on Deindexing Yoast SEO noindex posts