protected function sanitize_term_ids($terms, $taxonomy)
{
$term_ids = array();
foreach ($terms as $term) {
if (is_object($term)) {
$term_ids[] = $term->term_id;
} elseif (is_integer($term)) {
$term_ids[] = absint($term);
} else {
$term_object = get_term_by('name', $term, $taxonomy);
if ($term_object && !is_wp_error($term_object)) {
$term_ids[] = $term_object->term_id;
}
}
}
return $term_ids;
}