Opioids are commonly prescribed following childbirth, but data are lacking on trends in postpartum opioid prescribing over time. We examined whether a highly publicized 2006 case report questioning the safety of codeine during lactation was associated with changes in postpartum opioid prescribing. We conducted a cross‐sectional time series analysis of all publicly funded prescriptions for opioids to postpartum women in Ontario, Canada, from April 1, 2000, to March 31, 2017. The intervention was the publication of a case report in 2006 attributing the death of a breastfeeding neonate to maternal codeine use. The primary outcome was the rate of opioid prescribing to postpartum women. Among postpartum women eligible for prescription drug coverage, 17.5% filled an opioid prescription in the third quarter of 2006 (immediately prior to the intervention), with codeine representing 89.8% of all prescriptions. By the fourth quarter of 2010, only 12.2% of postpartum women filled an opioid prescription, representing a decline of 30% (P < 0.01), with codeine representing 71.9% of all prescriptions. During this period, we observed sizeable relative increases in the proportion of opioid prescriptions filled for morphine, hydromorphone, and oxycodone. By 2017, among women prescribed opioids post partum, 39.0% filled a prescription for codeine, while the remainder filled prescriptions for oxycodone (18.6%), morphine (25.5%), and hydromorphone (16.9%). A highly publicized case report questioning the safety of maternal codeine use during breastfeeding was associated with significant changes in opioid prescribing to postpartum women, including a decline in overall opioid prescribing and a shift from codeine to stronger opioids.