Opioid receptors function by binding to opioid ligands, which leads to a series of intracellular events. This binding inhibits adenylate cyclase activity, decreases cyclic AMP levels, and results in the opening of potassium channels and closing of calcium channels. These actions lead to hyperpolarization of the neuron and reduced neurotransmitter release, ultimately modulating pain, reward, and addictive behaviors.