Is $f$ constant if every point is local maximum or local minimum of $f$?
No. For example, let $$f(x)=\begin{cases}1 & x \in \Bbb{Q} \\ 0 & x \not \in \Bbb{Q}\end{cases}$$
If $f$ is not constant, simply define $f(x)=\chi_{\Bbb Q}$. Or more simply, define $f(x)$ to be any two-valued function on any subsets of $\Bbb R$.
In the above cases, not only is every point a local max/min, each point is, in fact, a global max/min. See copper.hat's answer for other instances where every point is either a local max/min, but not necessarily global.