I have glued magnets to acrylic with E6000. It works very well but I am not sure it would work for earring posts where there is much less contact area.
I would try it because E6000 is inexpensive and easy to work with, but 2-part epoxy might be the way to go.