Q:

Why acidity of p-methoxybenzoic acid is more acidic than p-hydroxybenzoic acid?

I know +M effect of $\ce{OCH3}$ is more than $\ce{OH}$, but in my book (ALLEN General organic chemistry), it is given that $\mathrm{p}K_\mathrm{a}$ of para-substituted benzoic acid containing $\ce{OCH3}$ is less than that of para-substituted benzoic acid containing $\ce{OH}$:

$\mathrm{p}K_\mathrm{a}$/Benzoic acid → $4.20$
$$
\begin{array}{lcccc}
\hline
\text{Substituent} & \mathrm{p}K_\mathrm{a} & \textit{o-} & \textit{m-} & \textit{p-} \\
\hline
\cdots \\
\ce{OMe} & - & 4.09 & 4.09 & 4.47 \\
\ce{OH} & - & 2.98 & 4.08 & 4.58 \\
\cdots \\
\hline
\end{array}
$$

I am in doubt whether these data wrong or correct. If correct, what can be an explanation?

A:

Both -$\ce{OCH3}$ and -$\ce{OH}$ groups have exhibited two effects on the aromatic ring: (1) Electron donating resonance or mesomeric effect (+M) and (2) Electron withdrawing inductive effect (-I). For both acids in hand, the electron withdrawing inductive effect (-I) is almost same since both -$\ce{OCH3}$ and -$\ce{OH}$ groups are 4 carbons away from the acid center. However, when -$\ce{OH}$ group is attached to either the para- or ortho-position, it has a more tendency to delocalize its lone pair electrons towards the aromatic ring than that of -$\ce{OCH3}$ group (Order of activating:  -$\ce{O-} \gt$  -$\ce{OH} \gt$  -$\ce{OCH3}$; for additional learning, read articles on Hammett plots).
As a result, the electron density on the carbon para to -$\ce{OH}$ substitution group increases more than that on the carbon para to -$\ce{OCH3}$ substitution group. Thus, the electron density on carbonyl carbon of carboxylic group attached to those para-carbons also increases accordingly, and consequently, the polarity of $\ce{O-H}$ of carboxylic group decreases as a result. That polarity decrease causes the reduced acidity ($\mathrm{p}K_\mathrm{a}$s are $4.58$ and $4.47$, when para-substitutions are $\ce{OH}$ and $\ce{OCH3}$, respectively) compared to benzoic acid ($\mathrm{p}K_\mathrm{a}$ is $4.20$ when para-substitution is $\ce{H}$). The $\mathrm{p}K_\mathrm{a}$s of p-hydroxybenzoic acid is higher than that of p-methoxybenzoic acid here, because as explained above, p-$\ce{OH}$ group caused reduced polarity on $\ce{O-H}$ of carboxylic group than that caused by p-$\ce{OCH3}$ group.  

