0
votes

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

Directions for any idea will be great.

3
does it work with regular search?user578493

3 Answers

1
votes

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');
0
votes

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 
'; 
0
votes

I've recently developed a plugin that provides custom taxonomy filtering through front-end forms (with dropdowns and an optional text input):

Advanced Custom Post Search

It runs off of its own results page and doesn't directly tie in with the default search.php, nevertheless its still very flexible and allows you to override the plugin pages in your theme.