Experience, n. The wisdom that enables us to recognize as an undesirable old acquaintance the folly that we have already embraced.
Once you understand the power of stimulus control, you can use it to your advantage by changing the stimuli in your environment and avoiding undesirable ones; or, if that's not possible, by filling your consciousness with thoughts about their less tempting aspects.
It is undesirable to believe a proposition when there is no ground whatsoever for supposing it is true.