Through statistical learning, humans can learn to suppress visual areas that often contain distractors. Recent findings suggest that this form of learned suppression is insensitive to context, putting into question its real-life relevance. The current study presents a different picture: we show context-dependent learning of distractor-based regularities. Unlike previous studies which typically used background cues to differentiate contexts, the current study manipulated task context. Specifically, the task alternated from block to block between a compound search and a detection task. In both tasks, participants searched for a unique shape, while ignoring a uniquely colored distractor item. Crucially, a different high-probability distractor location was assigned to each task context in the training blocks, and all distractor locations were made equiprobable in the testing blocks. In a control experiment, participants only performed a compound search task such that the contexts were made indistinguishable, but the high-probability locations changed in exactly the same way as in the main experiment. We analyzed response times for different distractor locations and show that participants can learn to suppress a location in a context-dependent way, but suppression from previous task contexts lingers unless a new high-probability location is introduced.