Skip to main contentSkip to footer

Total is a popular theme from WPExplorer. It mostly works fine with Relevanssi, with just one little issue.

Total sets the post_type parameter for all searches to include all public post types. This is fine for most cases, but if you want to include user profiles or taxonomy terms in the search results, Total will block them from appearing in the search results as well.

The solution for this is fortunately simple. Add this to your site:

add_filter(
  'relevanssi_modify_wp_query',
  function( $query ) {
    $query->set( 'post_type', '' );
    return $query;
  }
);

This simply wipes out the post_type parameter, leaving it up to Relevanssi to choose which post types are shown and which are not. If you want to, you can specify the post types you want to include in the parameter. For example to only shows pages and users, you can use:

add_filter(
  'relevanssi_modify_wp_query',
  function( $query ) {
    $query->set( 'post_type', 'page,user' );
    return $query;
  }
);

Thanks to Max Elman.

Your account

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

Search

Popular Resources

Multi-part excerpts
Relevanssi Premium 2.11 introduces a new feature: multi-part excerpts. There’s a new setting on the Excerpts & Highlights settings tab,…
Effect of Relevanssi on page speed

…So, if having a big Relevanssi table slows down the site, the effect should definitely be visible on this site. I ran three tests using a speed test tool provided by my hosting provider Seravo (one of the best WP hosting companies in the world, by the way). It’s basically……accessed at all except during searching, so it shouldn’t matter how big the table is. Fortunately site speed is something that can be measured, so we can make some actual experiments here. The experiment I used Kirjavinkit as the testing ground, because it’s one of the biggest sites I run….

Related Posts:

Comment Section:

1 Comment. Leave new

  • Hey there!

    This is Aj the developer of the theme and owner of WPExplorer.com. First of all thank you for posting this article. I’ll be sure to add a fix in the upcoming 4.8.3 update. Reading through your docs, it looks as simple as including “user” into the list of post types, which I don’t see any harm doing.

    Feel free to reach out to me in the future if you ever need or want to 😉

    Reply

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