Quantum electrodynamical density functional theory is applied to obtain the electronic density, spin polarization, as well as orbital and spin magnetizations of square periodic arrays of quantum dots or antidots subjected to the influence of a far‐infrared cavity photon field. A gradient‐based exchange‐correlation functional adapted to a 2D electron gas in a transverse homogeneous magnetic field is used in the theoretical framework and calculations. The obtained results predict a non‐trivial effect of the cavity field on the electron distribution in the unit cell of the superlattice, as well as on the orbital and spin magnetizations. The number of electrons per unit cell of the superlattice is shown to play a crucial role in the modification of the magnetization via the electron–photon coupling. The calculations show that cavity photons strengthen the diamagnetic effect in the quantum dot structure, while they weaken the paramagnetic effect in the antidot structure. As the number of electrons per unit cell of the lattice increases, the electron–photon interaction reduces the exchange forces that will otherwise promote strong spin splitting for both the dot and the antidot arrays.