modules/tag/models/Tag.php
public static function removeTags($tags, $tagType)
    {
        if (empty($tags)) {
            return;
        }

        foreach ($tags as $name) {
            $tag = self::find()
                ->where(['name' => $name])
                ->andWhere(['tag_type' => $tagType])
                ->one();
            if (!is_null($tag)) {
                $tag->updateCounters(['frequency' => '-' . self::DEFAULT_FREQUENCY]);

                if ($tag->frequency <= 0) {
                    $tag->delete();
                }
            }
        }
    }
public static function removeTags($tags, $tagType)
    {
        if (empty($tags)) {
            return;
        }

        foreach ($tags as $name) {
            $tag = self::find()
                ->where(['name' => $name])
                ->andWhere(['tag_type' => $tagType])
                ->one();
            if (!is_null($tag)) {
                $tag->updateCounters(['frequency' => '-' . self::DEFAULT_FREQUENCY]);

                if ($tag->frequency <= 0) {
                    $tag->delete();
                }
            }
        }
    }
Decrement frequency
if less then or equal to zero then delete row
@param $tags
@param $tagType