Authentication / login mechanism (non wp-admin)
You can use the wp_loaded hook to push all non-logged-in traffic to the login screen. Note how I’ve passed $_SERVER[‘REQUEST_URI’] to wp_login_url() – this is passed as a URL parameter to the login page, and once a user successfully signs in, they’ll be redirected back to the URL they were originally trying to visit. function … Read more