Posted on

Free 2.8.2

Here are the changes in 2.8.2 of Relevanssi Free. These are minor changes, but they can be quite important.

  • WordPress didn’t support searching for multiple categories with the cat query variable. There’s now new cats which can take multiple categories.
  • Similar to cats vs cat, you can use post_types to restrict the search to multiple post types.
  • The order parameter was case sensitive. It isn’t anymore.

Update 25.5.2011: The changelog was incorrect, this is correct.

Update through dashboard or get it from the repository.

2 comments Free 2.8.2

  1. Hi! I’m trying to do just this, using checkboxes in my search form to select categories I’d like to search in. Unfortunately, I’m getting an error from your code and I can’t understand why.

    Warning: explode() expects parameter 2 to be string, array given in /wp-content/plugins/relevanssi/lib/search.php on line 930

    cat1
    cat2
    cat3
    cat4
    cat5
    cat6
    cat7

    Any idea why this isn’t working?

  2. Well, of course, right after posting this, I figured it out. If anyone stumbles on this, here’s the solution.

    Relevanssi is expecting a comma separated string, but this gives an array, hence the explode not working on said array. We just need to add a little filter to implode them before relevanssi explodes them. (** this should be a check in the relevanssi code though **).

    function category_implode_query($query) {
    // The query expects a string of ids, but we get an array. Lets implode it.
    if(isset($query->query_vars[‘cats’]) && is_array($query->query_vars[‘cats’])){
    $query->query_vars[‘cats’] = implode(“,”, $query->query_vars[‘cats’]);
    }
    return $query;
    }
    add_filter(‘relevanssi_modify_wp_query’, ‘category_implode_query’);

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 *