我找到了解决方案:
我的ID+标记数组如下所示:
$array_tags_and_ids = [
\'239\' => ["car", "animal", "dog", "cat"],
\'243\' => ["dsa", "ewr", "bvc", "fgn"]
];
所以我会:
foreach ($array_tags_and_ids as $key => $value) {
// re-call the value and get only the text value
$implode_tags_names = implode( \', \', $value );
// wordpress function
wp_set_post_tags( $key, $implode_tags_names, true );
}
完成