WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a form that loops through all the terms of a taxonomy. Multiple terms can be selected and they get passed in the url. I'm trying to get all the terms on another page but I'm only able to get the last one. I'm not sure if this is the best way to do this but if anyone can give me a tip as to what I'm doing wrong.

First, here is the form

                        <form method="get" id="searchProperties" action="<?php echo home_url()?>/filter-2/?">
                        $termsCounty = get_terms( 'County', array(
                              'hide_empty' => 0
                              ) );
                        echo '<ul>';
                            foreach ($termsCounty as $term) {
                                $termCounty = $term->name . 'PropertyFilter';
                                echo '<li><label><input type="checkbox" name="t"  value="il_' . $term->name . '">' .$term->name. '</label></li>';
                        echo '</ul>';

                        ?><input type="submit" value="FILTER"/>

And here is where the choices are accessed:

echo $term = $_GET['t'];

Any suggestions? Thanks in advance!

share|improve this question
up vote 0 down vote accepted

Use brackets in the name attribute:

'<input type="checkbox" name="t[' . $term->name . ']"  value="1">

Then get the keys with:

array_keys( $_GET['t'] );

See also: Settings API with arrays example

share|improve this answer
Thanks, that worked! – graphical_force Jul 30 '13 at 1:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.