Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this questionI am trying to simply update the post query to only query posts with the taxonomy.
Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this questionI am trying to simply update the post query to only query posts with the taxonomy.
Share Improve this question edited Feb 26, 2022 at 19:13 asked Feb 24, 2022 at 20:47 user212573user212573 2- state is CPT or taxanomy? – amiad Commented Feb 24, 2022 at 20:51
- WHy you delted all the code and comments? – amiad Commented Feb 27, 2022 at 8:56
1 Answer
Reset to default 1You should use tax_query.
$args =
[
'posts_per_page' => 10,
'post_type' => 'post',
'post_status' => 'publish'
'tax_query' => array(
array(
'taxonomy' => 'state',
'field' => 'slug',
'terms' => 'minnesota', // lowercase m
),
];