如何找到wordpress分类ID?
我想创建一个术语exists查询...
if (term_exists(array(
'term_id' => 4,
'term_taxonomy_ID' => x
)))但是我不知道如何找到我的分类法的ID:‘file-format’
任何帮助都是很棒的,谢谢。
乔希
发布于 2012-03-09 20:39:19
你试过这个吗?
<?php
$terms = get_the_terms( $post->ID , 'file-formats' );
if($terms) {
foreach( $terms as $term_name ) {
echo $term_name->term_id."<br />";
}
}
?>祝你好运:)
发布于 2012-03-09 20:42:19
试试这个:http://codex.wordpress.org/Function_Reference/get_taxonomies或http://codex.wordpress.org/Function_Reference/get_term
试试这个:
<?php $terms = get_the_terms( $post->ID , 'taxonomy-name' );
if($terms) {
foreach( $terms as $term ) {
echo $term->term_id.'<br />';
}
}
?>https://stackoverflow.com/questions/9634105
复制相似问题