Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

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

#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)
     )
   )
);