最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

loop - I need to update the post query?

programmeradmin3浏览0评论
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 question

I 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 question

I 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
Add a comment  | 

1 Answer 1

Reset to default 1

You 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
        ),
  ];
发布评论

评论列表(0)

  1. 暂无评论