나는 분류법이 항상 싫지만 너무 혼란 스럽습니다. 나는 ACF를 사용하고있다. 나는 사용자 정의 사용자 등록 필드를 국가, 콘센트, 회사 (그들은 모두 택 소노 미)라고 부른다.Wordpress - 용어 ID (ACF)에서 분류 이름의 이름을 가져옵니다.
예 :
$country_tagid = the_field('country', 'user_'.$user_id->ID); //This output 36
$countrydata = get_terms('country',array('id'=>$country_tagid)); //
echo $countrydata->name; //return nothing
$getcountrydata = get_term($country_tagid);
print ($getcountrydata->name); //return nothing
그들 모두 분류 = 국가 & tag_ID = 36 & post_type = 회사 이름을 반환하지 않았다. 나는 그것이 '태국'을 반환 할 것으로 기대합니다. 뭐가 잘못 되었 니?
편집 : 이상한, 수동으로 사용자의 루프 외부에 입력했습니다.
<?php
$catinfo = get_term_by('id', 36, 'country');
print $catinfo->slug; //thailand
?>
이것은 작동합니다. 뭔가가 (36)가 지금은 get_field하기 위해 노력하고있어이 줄을 인쇄 여기
$country_tagid = the_field('country', 'user_'.$user_id->ID); //This output 36
잘못 생각한다. 하지만 그것은 나를
$ countrydata의 =의 get_terms ('
나는 그때까지 나라 이름을 검색
에 의해 ID를 검색 country ', array ('include '=> 배열 ($ country_tagid))); print_r ($ countrydata); Array()를 반환합니다. –