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

1 Answer 1


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

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.