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 Advanced Custom Fields Relationship fields

Advanced Custom Fields Relationship fields

Update 16.1.2018: There’s a better post on this topic at Indexing ACF Relationship Content. I’m working on a website and i’m use A LOT the Relationship field au ACF. So on my pages are displayed informations of some related custom post. Is there a way to get that working in the search ? With some…

Read more Advanced Custom Fields Relationship fields 1 Comment on Advanced Custom Fields Relationship fields
Continue reading Relevanssi and BBPress search

Relevanssi and BBPress search

Relevanssi does work with BBPress. BBPress forums, topics and replies are regular WordPress posts. In order to get Relevanssi working with BBPress, you need to make Relevanssi index post type “topic” (forget “forum”, and I think it’s better if you skip “reply” as well). Since “topic” is non-public post type, you also need to uncheck…

Read more Relevanssi and BBPress search 4 Comments on Relevanssi and BBPress search
Continue reading Indexing additional content

Indexing additional content

Sometimes you may want to index additional content to your posts. Perhaps dynamic content generated by some PHP script, perhaps data from another, external database. It is quite easy, as there’s a simple filter you can use. When Relevanssi indexes a post, it calls relevanssi_content_to_index to see if there’s additional content to index. This filter…

Read more Indexing additional content 8 Comments on Indexing additional content
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