public function saveTerms($name, $slug, $taxonomy, $parent = 0)
    {
        $term = get_term_by('slug', $slug, $taxonomy);
        if ($term == false) {
            $new_term = wp_insert_term($name, $taxonomy, array('slug' => $slug, 'parent' => $parent));
            $term_id = $new_term['term_id'];

            $this->activateNewGroup($term_id, $parent);
        } else {
            wp_update_term($term->term_id, $taxonomy, array('name' => $name, 'parent' => $parent));
            $term_id = $term->term_id;
        }

        return $term_id;
    }
public function saveTerms($name, $slug, $taxonomy, $parent = 0)
    {
        $term = get_term_by('slug', $slug, $taxonomy);
        if ($term == false) {
            $new_term = wp_insert_term($name, $taxonomy, array('slug' => $slug, 'parent' => $parent));
            $term_id = $new_term['term_id'];

            $this->activateNewGroup($term_id, $parent);
        } else {
            wp_update_term($term->term_id, $taxonomy, array('name' => $name, 'parent' => $parent));
            $term_id = $term->term_id;
        }

        return $term_id;
    }
public function saveTerms ( $ name , $ slug , $ taxonomy , $ parent = 0 ) { $ term = get_term_by ( 'slug' , $ slug , $ taxonomy ) ; if ( $ term == false ) { $ new_term = wp_insert_term ( $ name , $ taxonomy , array ( 'slug' => $ slug , 'parent' => $ parent ) ) ; $ term_id = $ new_term [ 'term_id' ] ; $ this -> activateNewGroup ( $ term_id , $ parent ) ; } else { wp_update_term ( $ term -> term_id , $ taxonomy , array ( 'name' => $ name , 'parent' => $ parent ) ) ; $ term_id = $ term -> term_id ; } return $ term_id ; }
Save or update taxonomy term
@param  string  $name     name
@param  string  $slug     slug
@param  string  $taxonomy taxonomy
@param  integer $parent   parent id
@return int
Save or update taxonomy term