有时需要显示网站主题与插件创建的所有自定义分类法名称,会用到下面的代码:文章源自知更鸟-https://zmingcx.com/display-custom-taxonomie.html
<?php $args = array( 'public' => true, '_builtin' => false ); $output = 'names'; // or objects $operator = 'and'; // 'and' or 'or' $taxonomies = get_taxonomies( $args, $output, $operator ); if ( $taxonomies ) { echo '<ul>'; foreach ( $taxonomies as $taxonomy ) { echo '<li>' . $taxonomy . '</li>'; } echo '</ul>'; } ?>
文章源自知更鸟-https://zmingcx.com/display-custom-taxonomie.html

版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论