Tax_Query无法使用WP_Query

Pet*_*e G 3 wordpress wordpress-theming wordpress-plugin

我一直在试图让我的头发试图让我的WP_Query中的tax_query工作.代码如下:

$nextSundayTalkArgs = array(  
        'post_type' => 'talk',  
    'posts_per_page' => 1,  
    'tax_query' => array(  
        array(  
            'taxonomy' => 'talk-type',  
            'field' => 'slug',  
            'terms' => 'sunday-talk'  
        )  
    )  
);  
$nextSundayTalkQuery = new WP_Query( $nextSundayTalkArgs );
Run Code Online (Sandbox Code Playgroud)

肯定有帖子类型为"talk"的帖子 - 如果我删除tax_query部分,正确的帖子显示就好了.有5个会话正确的分类术语"sunday-talk"(如果我尝试使用ID而不是slugs,它也不起作用).

奇怪的是,如果我将帖子类型更改为"发布"并将分类法更改为"类别",并省略"字段"和"条款"部分,则会返回我唯一的帖子,根本没有任何条款.

在我疯狂之前,任何帮助都非常感激.

Pet*_*e G 5

最终在Wordpress Stackexchange上找到了一些帮助.仍然没有100%确定我做错了什么,但似乎是我的功能布局和我正在使用的后循环问题index.php.

对于遇到此问题且感兴趣的任何人:

https://wordpress.stackexchange.com/questions/84607/custom-taxonomy-and-tax-query