WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] Search by taxonomy (2 posts)

  1. markomitranic
    Member
    Posted 10 months ago #

    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.

    http://wordpress.org/plugins/custom-post-type-ui/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 9 months ago #

    Not sure how I missed seeing this thread.

    What way are you using to make the actual query for posts?

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.