从输出中排除特定类别ID

问题描述

我的网站上有以下代码,用于输出“下载”帖子类型的类别列表。我希望排除某些类别以使其不出现在输出中,我该怎么做?

<?php
/**
 * Generate list of EDD categories to browse
 */
$args = array(
  'orderby' => 'name','hierarchical' => 1,'style' => 'none','taxonomy' => 'download_category','hide_empty' => 0,'depth' => 1,'title_li' => '',// 'parent' => 0
);
$categories = get_categories( $args );

if ( $categories ) {
  ?>
<div class="search-cats">
  <div class="search-cat-text">
    <?php _e( 'Browse by category: ','checkout' ); ?>
  </div>
  <nav>
    <?php
    /**
     * Generate list of EDD category links
     */
    foreach ( $categories as $category ) {
      $link = get_term_link( $category,'download_category' );
      echo '<a href="' . esc_url( $link ) . '" rel="tag">' . $category->name . '</a>';
    }
    ?>
  </nav>
</div>
<?php } ?>

解决方法

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

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

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