尝试隐藏单个术语时,Wordpress tax_query 未按预期运行

问题描述

我试图从我的资源页面存档页面中排除一个术语。我创建了一个自定义帖子类型“资源”,并在其中创建了一个名为 additional_category 的自定义分类法。在此我将帖子标记为门控或 LEAP。我想隐藏存档页面上显示的门控术语。我有以下代码,但它没有按预期工作。谁能告诉我我哪里出错了?

$some_args = array(
                'post_type'        => 'resources','posts_per_page'   => -1,'tax_query' => array(
                    array(
                        'taxonomy' => 'additional_category','terms' => 'gated','field' => 'slug','include_children' => false,'operator' => 'NOT IN'
                    )
                ),);

            $s = new WP_Query( $some_args );

            while ( have_posts() ) :
                the_post();

                /*
                 * Include the Post-Type-specific template for the content.
                 * If you want to override this in a child theme,then include a file
                 * called content-___.PHP (where ___ is the Post Type name) and that will be used instead.
                 */
                get_template_part( 'modules/u3gm-content',get_post_type() );

            endwhile;
        ?>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)