5. If $f(x)=\sin (2 x+\theta)+\sqrt{3} \cos (2 x+\theta)$ is an odd function, and it is decreasing in $\left[0, \frac{\pi}{4}\right]$, then a value of $\theta$ is ( ).
(A) $\frac{5 \pi}{6}$
(B) $\frac{2 \pi}{3}$
(C) $-\frac{\pi}{6}$
(D) $-\frac{\pi}{3}$
5. B.

Obviously, $f(x)=2 \sin \left(2 x+\theta+\frac{\pi}{3}\right)$.
From $f(x)+f(-x)=0$, we get
$$
\sin \left(2 x+\theta+\frac{\pi}{3}\right)+\sin \left(-2 x+\theta+\frac{\pi}{3}\right)=0 \text {, }
$$

which means $2 \sin \left(\theta+\frac{\pi}{3}\right) \cdot \cos 2 x=0$.
Thus, $\sin \left(\theta+\frac{\pi}{3}\right)=0$. Solving this, we get $\theta=k \pi-\frac{\pi}{3}$.
Therefore, $f(x)=2 \sin (2 x+k \pi)$.
Since $f(x)$ is a decreasing function in $\left[0, \frac{\pi}{4}\right]$, i.e., $\sin (x+k \pi)$ is decreasing in $\left[0, \frac{\pi}{2}\right]$, $k$ must be an odd number.
When $k=1$, $\theta=\frac{2 \pi}{3}$.