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

Taxonomy hide not working

programmeradmin1浏览0评论

I am trying to exclude a single term from my resource pages archive page. I have created a custom post type 'resources' and within that a custom taxonomy called additional_category. Within that I am tagging the post as gated or LEAP. I would like to hide the gated term from displaying on the archive page. I have the following code, but its not working as expected. Can anyone tell me where Im going wrong?

   $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 th

is 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;
        ?>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论