以下是我遇到的问题:
I have a custom post type called "developer"
This custom post type "developers" has a custom taxonomy, "developer", hierarchic
I want to programmatically insert into this custom taxonomy "developer" 2 terms
下面是我用来插入一个术语的函数和操作:
// programatically add terms to the taxonomy "developer"
function autoset_post_developer(&$post, $developer)
{
if(empty($developer)) return;
$cat = get_cat_ID($developer);
if(!$cat)
{
$cat = wp_insert_term($developer, \'developer\', array(
\'description\' => \'\' . $developer,
\'slug\' => sanitize_title($developer)
));
$cat = $cat[\'term_id\'];
}
if($cat)
{
$post[\'post_developer\'] = array($cat);
}
}
问题:wp\\u insert\\u term似乎不适用于我的自定义分类法