We present an ab initio method to calculate the clamped Pockels tensor of ferroelectric materials from density-functional theory (DFT), the modern theory of polarization exploiting the electric-enthalpy functional, and automated first- and second-order finite-difference derivatives of the polarizations and the Hellmann-Feynman forces. Thanks to the functional-independent capabilities of our approach, we can determine the Pockels tensor of tetragonal barium titanate (BTO) beyond the local density approximation (LDA), with arbitrary exchange-correlation (XC) functionals, for example, PBEsol. The latter, together with RRKJ ultra-soft pseudo-potentials (PP) and a supercell exhibiting local titanium off-centering, enables us to stabilize the negative optical phonon modes encountered in tetragonal BTO when LDA and norm-conserving PP are combined. As a result, the correct value range of r51, the largest experimental Pockels coefficient of BTO, is recovered. We also reveal that r51 increases with decreasing titanium off-centering for this material. The lessons learned from the structural, dielectric, and vibrational investigations of BTO will be essential to design next-generation electro-optical modulators based on the Pockels effect.