On a WordPress website, if visitors try to access any private page or post, WordPress redirects the visitor to 404 page of the user is not logged in. it does not provide any message or redirect user or login page. To resolve this issue, I have authored this WordPress plugin to redirect users to login page, you can either use the gist or download full plugin from GitHub.
After a successful login they will be redirected back to the original page they tried to access.
Here is the code on gist:
You can also download the Private Page Login Redirect WordPress Plugin from GitHub here https://github.com/pimedia/Private-Page-Login-Redirect.
Hope that helps.