Search by taxonomy
-
Hi guys,
great plugin really, makes a lot of stuff more accessible and automated.My question today is about searching by the taxonomy,
In my case, i have a few brands of pro equipment, so i assigned a “Brands” taxonomy to the custom post type. This taxonomy has a few categories, one of which is (slug) “raid”.While i was working with the original categories, the search worked fine with the code similar to one below, but i wanted more control so i am trying to add custom taxonomies.
//Get terms
$catID = get_category_by_slug(‘sample_category_name’);
$taxID = get_term_by(‘raid’);
$catID = $catID->term_id;
$taxID = $catID2->term_id;//Get the post results array
$args = array(‘post_type’=> array( ‘custom_post’ ), ‘category__and’ => array($catID, $taxID), ‘posts_per_page’ => -1);Of course, this code only works with categories, and i am trying to tweak it to work with categories AND taxonomies at the same time. I know this is not something that i should expect to be answered in the support, as nothing is really wrong with the plugin, but i did not know where else to ask 🙂 And i guess it will be an easy find for anyone else searching for the same thing.
- The topic ‘Search by taxonomy’ is closed to new replies.