Home › Forums › Back End › Can't get WordPress custom post type posts by custom taxonomy › Reply To: Can't get WordPress custom post type posts by custom taxonomy
October 18, 2015 at 3:58 am
#209849
rolandas
Participant
@Dragore, @Alen thanks for replies.
I found how to do it. In case anyone needs help:
$args = array (
'posts_per_page' => -1,
'post_type' => array( 'my-custom-post-type' ),
'order' => 'ASC',
'orderby' => 'title',
'cache_results' => true,
'update_post_meta_cache' => true,
'update_post_term_cache' => true,
'tax_query' => array(
array(
'taxonomy' => 'my-custom-post-type-category',
'field' => 'slug',
'terms' => array($current_post_ category)
)
)
);