Where in your site is a search that displays the excerpts in the first place? Is there anything unusual in the custom post type? How is the post content stored and structured? Is it just regular post content, or are you using a page builder or something like ACF?
Thread Starter
cathyx
(@cathyx)
The excerpts are not used in the posts themselves (displaying anywhere on the frontend) but rather just adding keywords into the excerpt for users to search for. Basically, they sometimes use it like tags.
For instance, they’ve added “Financial Fitness” into the excerpt. Which works when I add it to a post, but not on the CPT.
The excerpt on the CPT is using the standard WP Excerpt box, the content on the rest of the page has been set up using ACF.
The problem is not the content on the page not indexing but rather just the content inside the excerpt on the CPT.
The CPT has been added with CPTUI.
Ah, I see. There should be problems with this. Relevanssi doesn’t care about the post type, and fetches the excerpt from $post->post_excerpt. As long as it’s there, Relevanssi should read it.
Have you tried the Relevanssi debugger to see whether Relevanssi indexes the excerpt content or not? You can also use the relevanssi_indexing_tokens filter hook to see how Relevanssi sees the excerpt:
add_filter( 'relevanssi_indexing_tokens', 'rlv_test_excerpt', 10, 2 );
function rlv_test_excerpt( $tokens, $context ) {
if ( 'excerpt' === $context ) {
error_log( 'Excerpt tokens: ' . wp_json_encode( $tokens ) );
}
return $tokens;
}
Add this to your theme functions.php and then go save a CPT post and see what gets printed in the error log.
Thread Starter
cathyx
(@cathyx)
Hmm, checked both the error log and the debugging tab in the plugin and its definitely finding the excerpt. Where would the problem be then? With search and filter?
I’d start by making sure the search results are actually from Relevanssi. If you disable Relevanssi, do the results change? Do you have the Relevanssi mode enabled in Search & Filter?
Thread Starter
cathyx
(@cathyx)
Ok that doesn’t seem to make a difference.
I had all the options ticked for Relevanssi and also “Sort Results By relevance? and “Force is_search to always be true?”.
I am however using a separate template for the results. Just using “$query” with no parameters. Not sure if this makes a difference?
Looks like you’re not seeing Relevanssi results in the first place, then. I don’t know much about Search & Filter, so perhaps asking their support might be a good idea.