WC_Product::sanitize_term_ids PHP Метод

sanitize_term_ids() защищенный Метод

Get term ids from either a list of names, ids, or terms.
С версии: 2.7.0
protected sanitize_term_ids ( array $terms, string $taxonomy )
$terms array
$taxonomy string
    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;
    }
WC_Product