functions.phpで以下のコードを試しました
function some_func($post_ID) {
global $authordata;
if( !is_null($authordata) ) {
wp_set_object_terms($post_ID,2,'item_cat'); // I want to get this result.
} else {
wp_set_object_terms($post_ID,7,'item_cat'); // $authordata seems to return NULL, and I get this result.
}
}
add_action('publish_my_post_type','some_func');
最終的に、編集ページの作成者 ID (何らかの理由で現在のユーザー ID ではありません) を取得したいと考えています。