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

functions - WP Query using tax_query & meta_query

programmeradmin0浏览0评论

I have a custom post type called events.

I have a custom taxonomy called issueEvent.

I have several ACF fields on the taxonomy. The one I have to query by is a checkbox.

I want to query 3 specific taxonomy items via ACF field AND slug. This is what I have so far:

    $a = array(
    'post_type'         =>  'events',
    'relation'          =>  'AND',
    'meta_query'        =>  array(
        array(
            'key'       =>  'type',
            'value'     =>  'Archived Event',
            'compare'   =>  'LIKE'
        )
    ),
    'tax_query' =>  array(
        array(
            'taxonomy'      =>  'issueEvent',
            'field'         =>  'slug',
            'terms'         =>  array('june-2019','april-2019','february-2019'),
            'operator'      =>  'LIKE'
        )
    ),
);
$b = new WP_Query($a);

I have tried both the standard WP Query (see above, loop not included), and get_terms. The current loop as seen above does not show any results within the loop.

I hope this makes sense, I need some guidance. Thank you

发布评论

评论列表(0)

  1. 暂无评论