I have taught that it is wrong to use a past tense verb after "to".
[OK. I am a teacher, and I have told my students this before. "have taught": active voice]
I was taught that it is wrong to use a past tense verb after "to".
[OK. I am a learner, and teachers taught me this rule in the past. "was taught": passive voice. Also, I "have been taught (before now): passive voice)
Are both sentences correct?
[Yes, but different meaning. The first one is possible, but a little strange: teachers would perhaps say, "I have taught them that it is wrong ..." or "I always teach them that it is wrong ..."]