Skip to main contentSkip to footer

Sometimes Relevanssi can get confused and indexes the post content under the wrong post ID. The main symptoms for this are:

  • You can’t find a post with words you know should be in the post
  • Searching for a word returns a post that doesn’t have that word

You can confirm this problem by checking the posts involved with the Relevanssi debugger that shows how Relevanssi has indexed the post. If you have this specific problem, you’ll find that the posts either have no or too little content indexed, or have a lot of content that seems to be from the wrong post.

That’s what’s going on: when Relevanssi indexes a post, it gathers up the content in the post and then stores it in the wp_relevanssi database table under the correct post ID. However, in some cases, the process may get disturbed and the content will end up under the wrong post ID.

The most typical cause for this problem is when you have a post loop element on a page. This may be a block or a shortcode, but it’s something that loops through posts. When Relevanssi sees this element and indexes it, it runs the loop and in some cases, the loop will change the post ID Relevanssi thinks it’s indexing.

Solutions

A simple solution is to exclude the loop element from index. The exact method depends on if it’s a block, a shortcode or something else, but if you exclude it, it won’t confuse Relevanssi anymore.

If this is your shortcode, you can write the code in a way that doesn’t confuse Relevanssi. These problems come when your code changes the global $post value. In general, messing with that is not a good idea, so if your loop code uses new WP_Query(), rewrite it to use get_posts() instead. In most cases, using WP_Query should be restricted to templates and in other cases you should use get_posts().

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Voice Search

…page under the “Searching” tab. There are three main controls for this feature: Voice search: Toggles the microphone icon on or off for all search forms on your site. Voice search autosubmit: If enabled, Relevanssi will automatically trigger the search once the user stops talking. If disabled, the text will……class added when the API specifically detects a human voice. Voice search is currently supported by Chrome, Edge, and Safari. Because the technology requires a secure connection, voice search will only appear on sites running over HTTPS. Here is the list of compatible browsers. Note on Firefox: As of now,…Modern search is about accessibility and speed. Relevanssi now includes a Voice Search feature that allows your visitors to search your site using their microphone. Instead of typing, they simply click a microphone icon and speak their query directly into the search bar. This feature is powered by the Web…

How to include specific posts

Hello, I’m using WooCommerce and Relevanssi and they work great. My Site Search only searches Products, however I want to let certain posts appear in the search results. Is there a way to allow certain posts to be in the results? Yes. There are many ways to do this, and…

Co-authors Plus
Co-Authors Plus is a neat plugin that makes it possible to have multiple authors for one post in WordPress. This…

Related Posts:

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed