If $$u: \Omega \subset \mathbb {R}^d \rightarrow \textrm{X}$$
u
:
Ω
⊂
R
d
→
X
is a harmonic map valued in a metric space $$\textrm{X}$$
X
and $$\textsf{E}: \textrm{X}\rightarrow \mathbb {R}$$
E
:
X
→
R
is a convex function, in the sense that it generates an $$\textrm{EVI}_0$$
EVI
0
-gradient flow, we prove that the pullback $$\textsf{E}\circ u: \Omega \rightarrow \mathbb {R}$$
E
∘
u
:
Ω
→
R
is subharmonic. This property was known in the smooth Riemannian manifold setting or with curvature restrictions on $$\textrm{X}$$
X
, while we prove it here in full generality. In addition, we establish generalized maximum principles, in the sense that the $$L^q$$
L
q
norm of $$\textsf{E}\circ u$$
E
∘
u
on $$\partial \Omega $$
∂
Ω
controls the $$L^p$$
L
p
norm of $$\textsf{E}\circ u$$
E
∘
u
in $$\Omega $$
Ω
for some well-chosen exponents $$p \ge q$$
p
≥
q
, including the case $$p=q=+\infty $$
p
=
q
=
+
∞
. In particular, our results apply when $$\textsf{E}$$
E
is a geodesically convex entropy over the Wasserstein space, and thus settle some conjectures of Brenier (Optimal transportation and applications (Martina Franca, 2001), volume 1813 of lecture notes in mathematics, Springer, Berlin, pp 91–121, 2003).