For a function $f(x,y)$, the stationary points are those points s.t. $\left\{ {\begin{array}{*{20}{c}} {\frac{{\partial f}}{{\partial x}} = 0} \\ {\frac{{\partial f}}{{\partial y}} = 0} \end{array}} \right.$. If the second equation has ${\frac{{\partial f}}{{\partial y}} = 0} \Rightarrow y=g(x)$, then it can be plugged into the first equation and we have $\frac{∂f}{∂x}=0⟺{\frac{{\partial f}}{{\partial x}}(x,g(x)) = 0}$ (first do the partial derivative, then plug $y = g(x)$ in).
My confusion is, can we first plug $y=g(x)$ into $f$ and then solve ${\frac{{\partial f(x,g(x))}}{{\partial x}} = 0}$? My feeling is that $\frac{{\partial f(x,g(x))}}{{\partial x}} = 0$ is not equivalent to $\frac{{\partial f}}{{\partial x}}(x,g(x)) = 0$. Can anyone help provide a counter example? An is there any special situation where such plug-in holds?