Support » Plugin: Relevanssi - A Better Search » Ignore search term

  • Resolved bohboh2112


    I want to use my custom search page as a browse page, that means i want to have it ignore the search term, and instead just return posts from within a custom post type and grouped by custom taxonomy.

    Is this possible? Everytime i omit the search term, it returns nothing.

    This is what I have so far:

    $search_types = isset($_GET['types']) ? $_GET['types'] : $post_types[0]['type']; // e.g. shoppinglist
    $query->query_vars['s'] = $search_term;
    $query->query_vars['taxonomy'] = 'fruit';
    $query->query_vars['term'] = 'oranges';
    $query->query_vars['posts_per_page'] = 5;
    $query->query_vars['operator'] = 'or';
    $query->query_vars['post_type'] = array($search_types);
    $query->query_vars['paged'] = get_query_var( 'paged' );

    with a $search_term works, without doesnt, how do i get it to just return all ‘shoppinglist’ post_types which are tagged ‘oranges’ from the ‘fruit’ custom taxonomy.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ignore search term’ is closed to new replies.