Posted on

Debugging indexing problems

The easiest way to debug indexing problems is to use the WP CLI tools available in Relevanssi Premium. To see how Relevanssi sees the post 123, just use the following command on the command line:

wp relevanssi index --post=123 --index_debug=true

This will print out how Relevanssi sees the post, how it appears in the different steps of the indexing process and the database queries Relevanssi uses to save the post data.

If WP CLI is not available or you are using free Relevanssi, this’ll do pretty much the same thing:

add_action( 'wp', function() {
 if (is_user_logged_in()) {
  relevanssi_index_doc( 123, false, relevanssi_get_custom_fields(), true, true );
  exit();
 }
});

Add this snippet to your theme functions.php file and change 123 to the ID number of the post you want to inspect. Then go visit any page on the front-end of your site. Once you’re done, remove the code.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.