The pill and antibiotics

I just heard that if you take antibiotics whilst on the pill the antibiotics will cancel the pill out resulting in possibly unwanted pregnancy.

Is this only for the week after you take antibiotics or forever after you take antibiotics? I’m confused