The present invention relates to polymer, homo- or copolymer or oligomer for the photoalignment of liquid crystals, especially for the planar orientation of liquid crystals, comprising a main chain and a side chain, wherein the side chain and/or main chain comprises a polar group, compositions thereof, and its use for optical and electro optical devices, especially liquid crystal devices (LCDs).