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 How to add custom fields to search excerpts

How to add custom fields to search excerpts

Getting Relevanssi to index custom fields and find posts by custom field content is easy – just list the custom fields in the appropriate setting and re-index. However, Relevanssi doesn’t include custom field content in the custom search excerpts by default – it doesn’t really know how to do that. It’s not particularly complicated, though.…

Read more How to add custom fields to search excerpts 59 Comments on How to add custom fields to search excerpts
Continue reading Which custom fields had the hit?

Which custom fields had the hit?

While the free version of Relevanssi will match search terms in custom field content, it doesn’t know which custom field had the matching content. Premium has that information and it can be made available. First, you need this in your functions.php: add_filter(’relevanssi_match’, ‘cfdetail’); function cfdetail($match) { global $customfield_data; $customfield_data[$match->doc] = $match->customfield_detail; return $match; }add_filter(‘relevanssi_match’, ‘cfdetail’);…

Read more Which custom fields had the hit? 10 Comments on Which custom fields had the hit?
Continue reading Modify excerpts with relevanssi_excerpt_content

Modify excerpts with relevanssi_excerpt_content

From free 2.9.1 and Premium 1.5.8, there’s a new filter that makes modifying the excerpts easier. The relevanssi_excerpt_content filter is run after the post content is run through the the_content filter and before any other cleanup is done. This is a good point to insert for example custom field content. The filter hook passes three…

Read more Modify excerpts with relevanssi_excerpt_content 33 Comments on Modify excerpts with relevanssi_excerpt_content