Here is an extended hint. $(p-1)! + 1$ is more or less constructed to have the property that it cannot be divisible by any primes less than $p$. So, you can try to show that aside from the constant and linear polynomials $f(p) = \pm 1, \pm p$, it is not possible for $f(p)$ to have the same property; it must eventually be divisible by some small prime. (You need a separate argument to handle the case $f(p) = \pm p^k$ but this is easy to deal with by plugging in $p = 2$.)
For example, suppose $f(p) = p^2 + 1$. Ignoring the fact that this can be ruled out by plugging in $p = 2$ (in general this style of argument doesn't generalize because we can use polynomial interpolation to arrange for the first few values of $f(p)$ to be equal to $\pm 1, \pm p$ if necessary), you can look at patterns in the prime factorizations of $f(p)$ for various primes $p$. We get that
$$f(3) = 2 \cdot 5$$
$$f(5) = 2 \cdot 13$$
$$f(7) = 2 \cdot 5^2$$
$$f(11) = 2 \cdot 61$$
and so on. In particular $f(p)$ is always even for $p > 2$, but $(p-1)! + 1$ is always odd for $p > 2$, so the former can't divide the latter. You can try to see if this observation generalizes by considering other possible choices for $f$ (for example you could try $f(p) = p^2 + 2$ or $p^3 + 1$) and writing down the prime factors of their values as above.