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

as always after struggling my mind for 3 days with a problem i decide to ask for help here.

Im trying to create an advance search page with taxonomies and keyword field. You can see what i actually got in http://alianzasuperior.com/empleo/busqueda-avanzada/ ( dont panic, its spanish but just think as taxonomies and you will be ok)

The keyword part is working fine. I can also create taxonomies pages for example taxonomy-job_type.php to handle an individual taxonomy and it works aswell.

The problem is when i try to search in multiple taxonomies , and multiple terms for those taxomies. I tried to figure it out with scribu plugin "query multiple taxonomies" but im not able.

Someone did something similiar for what im trying to do?

Any help or clue will me much appreciate

share|improve this question
up vote 3 down vote accepted

like other times, after posting here i found my own question. Maybe its not the smarter solution but its working for me.

Im using the new tax_query as commented in http://www.wpmods.com/query-multiple-taxonomies-in-wp-3-1/

Basically if i get 2 taxonomies with two terms for example


I do the following:

    $myquery['tax_query'] = array( 'relation' => 'AND');

        if ($_GET['job_type']){
            foreach ($job_type as $k => $name){
            array_push($myquery['tax_query'],array('taxonomy' => 'job_type','terms' =>$job_types,'field' => 'slug' ,'operator' => 'IN'));

        if ($_GET['job_cat']){
            foreach ($job_cat as $k => $name){
            array_push($myquery['tax_query'],array('taxonomy' => 'job_cat','terms' => $job_cats,'field' => 'slug','operator' => 'IN'));


And then if i got more than one term i use the custom query:

if($custom_query) query_posts($myquery);

If you want to mix it with keyword search just do:

$myquery['s']= $yourKeywordVar;

Hope that helps, I just discovered and so far my tests are working fine

share|improve this answer

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.