I am having issues getting my posts to be shown by the tag-name in WordPress. I have a Custom Post Type called Reviews with a (taxonomy?) category named Gametypes. Within Gametypes I have a tag named Newest.
I am trying to get posts to display which is tagged by the Newest tag. I have tried the following code which does not work, and I am not sure why:
$args = array( 'tax_query' => array( array( 'taxonomy' => 'Gametypes', 'field' => 'slug', 'terms' => 'newest' ) ) );
$postslist = get_posts( $args );
I’ve tried different iterations of it with and without capital starting letter but I cannot seem to get it to work. Anyone who could shed light upon what I am doing wrong? I am able to pull every post from Reviews (posts with and without tags) with this code:
$args = array( 'post_type' => 'Reviews', 'numberposts' => 6, 'order'=> 'DESC', 'orderby' => 'date' );
In case this information helps. I hope someone can guide me in the right direction!
2
Answers
I found the answer myself, in case anyone wonders!
Use this one: