WordPress.org

Forums

Relevanssi - A Better Search
[resolved] wp_dropdown_categories() returning all results (4 posts)

  1. guit4eva
    Member
    Posted 8 months ago #

    Awesome plugin! I just have a small problem though:

    I'm using custom taxonomies and am trying to build a search that is restricted to a city, such as All Libraries in SmallVille, using:

    <form id="searchform" method="get" action="<?php bloginfo('url'); ?>">
        <input type="text" name="s" id="s" size="15" class="city"> <p class="in">in</p>
        <?php wp_dropdown_categories('taxonomy=location&show_option_all=Select city&exclude=1'); ?>
    </div>
    </div>
        <div class="submit-button"><input type="submit" value="Search" /></div>
    </form>

    Unfortunately, which ever city is selected still brings up all results in all cities. Is there some special trick I need to do to get it to work?

    https://wordpress.org/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 8 months ago #

    Try changing

    wp_dropdown_categories('taxonomy=location&show_option_all=Select city&exclude=1');

    to

    wp_dropdown_categories('taxonomy=location&name=location&show_option_all=Select city&exclude=1');

  3. guit4eva
    Member
    Posted 8 months ago #

    Oh my goodness, I can't believe that just adding 'name=location' would have saved me five hours of head banging ha ha:) But awesome, it works!!! Thanks so much, your plugin is definitely the best I've ever tried!! :D

  4. Mikko Saari
    Member
    Plugin Author

    Posted 8 months ago #

    The default value is not particularly helpful there, yes.

Reply

You must log in to post.

About this Plugin

  • Relevanssi - A Better Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic