views:

161

answers:

2

Want to know is there any plugin/hack available for searching custom taxonomies in wordpress?

Directions for any idea will be great.

A: 

Tricky business... This will get you started, this queries the top five tags (taxonomy: post_tag)...

// query the top five tags
$sql = '
    SELECT wt.term_id ti,wt.name, wtt.count tc,wtr.term_taxonomy_id tti, wtr.object_id oi 
    FROM wp_terms wt 
    INNER JOIN wp_term_taxonomy wtt ON wt.term_id = wtt.term_id 
    INNER JOIN wp_term_relationships wtr ON wtr.term_taxonomy_id = wtt.term_taxonomy_id 
    LEFT JOIN wp_posts wp ON wp.ID = wtr.object_id 
    WHERE taxonomy = \'post_tag\' 
    GROUP BY name 
    ORDER BY count DESC LIMIT 0 , 5 
'; 
superUntitled
Don't know where to implement this
Mighty Jack
A: 

How about this?

function search_by_tax_filter(&$query)
{
    if ($query->is_search)
        $query->set('taxonomy', 'taxonomy_name');
}
add_action('parse_query', 'search_by_tax_filter');
TheDeadMedic