(And when We put a revelation in place of (another) revelation…) [16:101-102].
This verse was revealed when the idolaters said: “Muhammad is mocking his Companions; one day he commands them to do something and the next day he forbids them from doing it, or brings instead something which is easier. He is nothing but a calumniator who says things of his own invention”, and so Allah, exalted is He, revealed this verse and the verse after it.
Asbab Al-Nuzul by Al-Wahidi , trans. Mokrane Guezzou