Displaying Custom Taxonomies From Multiple Custom Post Types

I figured it out. Setting ‘relation’ to ‘OR’ is important. <?php $myquery[‘tax_query’] = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘terms’ => array(‘home-slides’), ‘field’ => ‘slug’, ), array( ‘taxonomy’ => ‘miss_behave_category’, ‘terms’ => array(‘home-slides-1’), ‘field’ => ‘slug’, ), array( ‘taxonomy’ => ’emily_category’, ‘terms’ => array(‘home-slides-2’), ‘field’ => ‘slug’, ), ); query_posts($myquery); ?>

Hiding taxonomies with no children WP_Query & tax_query

UPDATE! OK!!! Woooohooo! Found out what it was.. I should have been calling if have posts before the call for $tax->name; Here is my final, and working code! 🙂 <?php /**********************************************/ // CUSTOM WINE MENU SHORTCODE /**********************************************/ add_shortcode( ‘wine_list_per_cat’, ‘wine_list_per_cat’ ); function wine_list_per_cat($atts){ global $woocommerce_loop; extract(shortcode_atts(array( ‘cat’ => ”, // list of categories in the … Read more

I am trying to hide a custom post type category to logged in users with Pre_Get_Posts

OK, so you have few mistakes in there. field can be term_id or slug, but not id. tax_query should be array of arrays and not an array. So here is fixed code: function exclude_category( $query ) { if ( is_user_logged_in() && $query->is_main_query() ) { $taxquery = array( array( ‘taxonomy’ => ‘project-type’, ‘field’ => ‘term_id’, ‘terms’ … Read more