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 have a function of custom taxonomies to display a drop down list on my website, which is working fine, but there is one problem, the default value is a custom taxonomy, but that i dont want, i want a custom word, like select cause the current default value, when i select it, it is not redirecting to the corresponding page, if you wanna chaeck it, goto my website, on the home page i have kept that drop-down list www.mbas.in

and the code of the function is

function the_taxonomy_dropdown($taxonomy) {
      $id = "{$taxonomy}-dropdown";
      $js =<<<SCRIPT
    <script type="text/javascript">
        window.location.href = $(this).val();
      echo $js;
      $terms = get_terms($taxonomy);
      echo "<select name=\"{$id}\" id=\"{$id}\">";
      foreach($terms as $term) {
        echo '<option value="';
        echo get_term_link(intval($term->term_id),$taxonomy);
        echo '">' . "{$term->name}</option>";
      echo "</select>";
    function jquery_init() {

what i do for keeping default value as Select ????

share|improve this question
Do not redirect your visitor onChange. Without a mouse it will be very hard to get to the third item. – toscho Dec 10 '10 at 16:03
what if i want to use another drop down with diff taxonomy so that if user select anything from that drop down it redirects to the corresponding template. – user48408 Mar 3 '14 at 6:03
@Rahul that would be a new question – Tom J Nowell Mar 3 '14 at 6:09
up vote 2 down vote accepted

Not sure exactly what you're asking. Do you just want to include a blank value before the list of terms? Would this work:

echo '<option value="#"> - Select - </option>';

(inserted just before the line foreach($terms as $term) {)

share|improve this answer
hey thanks it worked, it was so easy i didnt figured it out, thanks for your help – ntechi Dec 10 '10 at 9:05

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.