Checkboxed term search

I built something similar for a client not too long ago. I believe your question is if it is possible — I can definitely say yes there. How would you go about it? Well, as I don’t have the code handy, I’ll give you a brief run-down of the steps I went about.

  1. I made a custom page template and created a page to use this template. In the template, I wrote an HTML form with action="" and method="POST" and set-up the checkboxes manually. You might be able to use get_terms to avoid having to do it manually. I made sure the name‘s of all my checkboxes were xxxx[].
  2. As I wanted to handle the form in the same page (thereby setting action=""), I added a check for the POST variable sent by the form. If it was present, it would display the form and the search results (coming to that later). If it wasn’t present, only the form would show. if(!isset($_POST['xxxx']))
  3. In the else-block (the one executed if the form had been submitted) I then set-up the following arguments for the coming WP_Query object:
    $args['tax_query'][] = array(
    'taxonomy' => 'taxonomy_name_here',
    'field' => 'slug'
    'terms' => $_POST['xxxx']
    );
  4. I then created the WP_Query object and pulled the results from it.

I hope this makes sense – I went on and AJAX-ified this along with a few other modifications, however this example shows the backbone on which I built this.

Good luck!

error code: 523