Posted on

Total

Total theme

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.

One comment Total

  1. 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 ๐Ÿ˜‰

Leave a Reply

Are you a Relevanssi Premium customer looking for support? Please use the Premium support form.

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