  We introduce the trace operator for quasi-plurisubharmonic functions on
compact K\"ahler manifolds, allowing to study the singularities of such
functions along submanifolds where their generic Lelong numbers vanish. Using
this construction we obtain novel Ohsawa--Takegoshi extension theorems and give
applications to restricted volumes of big line bundles.
