Viewing 1 replies (of 1 total)
  • Plugin Author Mikko Saari

    (@msaari)

    add_filter('relevanssi_modify_wp_query', 'rlv_category_switch');
    function rlv_category_switch($query) {
        if (!isset($_GET['cs'])) {
            $query->set('category__not_in', array(CAT_ID));
        }
        else {
            $query->set('category__in', array(CAT_ID));
        }
        return $query;
    }

    Add this to your theme functions.php and replace CAT_IN with the category ID of the category you want to exclude. Then in the single category search form, add this:

    <input type="hidden" name="cs" value="1" />

    That should do it.

Viewing 1 replies (of 1 total)
  • The topic ‘Need two separate search fields which index different categories…’ is closed to new replies.