I'm trying out a couple of plugins to aid in searching of taxonomy terms. One is called "Query Multiple Taxonomies" and the other is called "Drop-down-custom-taxonomy".

What I'm wanting to keep the page I'm searching from when I begin the search. For example if the page I'm on is dogs (www.site.com/dogs) and I run a search on this page for a taxonomy called "breed", and find all dogs that are a "beagle", the url is changed to this:


How can I get the url to stay with /dogs in it?


Based on my limited knowledge, I'd say this is a job for url rewriting? I did try adding some code for a base url for Query Multiple Taxonomies but this did not work with my permalink structure of /%year%/%postname%/

1 Answer 1


Just change the action attribute of your search form in your theme, for example;

<form action="<?php echo home_url( $GLOBALS['wp']->request ); ?>" method="get">

This will dynamically output the URL of the current request, so that when a user searches, the query string is simply appended to it, rather than pointing back at the root.

  • Thanks, nice tip. This fixes the default WP search box but it doesn't have any effect on the taxonomy dropdowns I am using. They still start searching from the homepage. I found that Query Multiple Taxonomies has a "base URL" filter that can be set but it doesn't work with my /%year%/%postname%/ permalinks. github.com/scribu/wp-query-multiple-taxonomies/wiki/…
    – Andrew
    Commented Jul 5, 2011 at 23:23
  • The other plugin uses the following. Perhaps I can modify the window.location.href? <script type="text/javascript"> jQuery(document).ready(function($){ $("select#{$id}").change(function(){ window.location.href = $(this).val(); }); }); </script>
    – Andrew
    Commented Jul 5, 2011 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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