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

Searching between dates
If you want to have a search with a date range, that’s possible with Relevanssi. It takes a bit of…
GDPR Compliance

…except when you index attachment content. That Relevanssi can’t do on your own server. In order to index attachment content, the attachment is sent to a Relevanssi indexing server. These servers are hosted by UpCloud (their privacy policy) and are in the US or in EU. You can choose which……doesn’t share any information outside your own server. There are, however, two exceptions. Logging If you enable logging, Relevanssi will log all search queries, except from those users you block in the settings. The logs will always include the user ID and if you so desire, the user IP address….…completely from the system, that will automatically remove all log entries with their user ID. Relevanssi can’t automatically remove log entries for searches users do when they are not logged in, as Relevanssi cannot connect IP address to user ID. Attachment indexing Relevanssi doesn’t share any information outside your server,…

Pinning posts
Sometimes you want to get a specific post as the first result for a certain search, but Relevanssi doesn’t return…

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