0
array_column을 사용하여 wp_get_post_terms에서 term_ids 배열을 추출하려고하는데 아무 것도 반환하지 않습니다.Wordpress array_column이 wp_get_post_terms에서 작동하지 않습니다.
$atype: Array
(
[0] => WP_Term Object
(
[term_id] => 51
[name] => Office
[slug] => office
[term_group] => 0
[term_taxonomy_id] => 51
[taxonomy] => property_category
[description] =>
[parent] => 0
[count] => 1
[filter] => raw
)
)
$types: Array
(
)
$types2: Array
(
[0] => 51
)
왜 작동 array_column되지 않습니다
여기$atype = wp_get_post_terms($property_ID, 'property_category', true);
$types = array_column($atype, 'term_id'); // Not working so using array map
$types2 = array_map(function($te) {
return $te->term_id;
}, $atype);
echo '$atype: ';
echo '<pre>'; print_r($atype); echo '</pre>';
echo '$types: ';
echo '<pre>'; print_r($types); echo '</pre>';
echo '$types2: ';
echo '<pre>'; print_r($types2); echo '</pre>';
이 결과 : 여기
코드인가? 문서를 기반으로해야합니다. 나는> php 5.5를 사용하고있다. 야 http://php.net/manual/en/function.array-column.php