If the pope goes against the teachings of the Catholic Church, he ceases in that moment to be a Catholic teacher.
The last several popes have knowingly allowed gays to infest the Vatican, knew of the homo sexual abuse of children, etc.
Did they cease being Catholic teachers in the moment they looked the other way?
No. Those are grave sins — either omission or commission, or both, damnable sins -— but these acts are not teachings. They are not teaching that it’s all right.