For the lorenz gauge we can either write:
$$\nabla \vec A(\vec r,t)+\frac{1}{c^2}\frac{\partial \phi(\vec r,t)}{\partial t}=0$$
If we also consider the following invariant transformations:
$$\vec A(\vec r,t)'= \vec A(\vec r,t) + \nabla f(\vec r,t)$$
$$\phi(\vec r,t)'=\phi(\vec r,t) - \frac{\partial f(\vec r,t)}{\partial t}.$$
Then we can have:
$$\nabla \vec A(\vec r,t)'+\frac{1}{c^2}\frac{\partial \phi(\vec r,t)'}{\partial t}=g(\vec r,t)$$
And from here by substituting the transformations in this final equation we find:
$$\square f(\vec r,t)= g(\vec r,t)$$
But we can also assume the following:
$$\nabla \vec A(\vec r,t)'+\frac{1}{c^2}\frac{\partial \phi(\vec r,t)'}{\partial t}=0$$
And from here we find out that:
$$\square f(\vec r,t)= -(\nabla \vec A(\vec r,t) +\frac{1}{c^2}\frac{\partial \phi(\vec r,t)}{\partial t}$$
So from this you can see that the condition $$\nabla \vec A(\vec r,t)+\frac{1}{c^2}\frac{\partial \phi(\vec r,t)}{\partial t}=0$$ sometimes is applied on the non-transformed potential $\vec A(\vec r,t)$ and sometimes is applied in the transformed potential $\vec A(\vec r,t)'$
So, when I need to solve a random exercise, which case should I consider?