This function redirects a user who is not logged in to the login page (if one is set in the main options tab).
(string) (optional) URL to redirect back to following login. (default: false)
Redirect all content that is not the login page, register page, or user profile (for forgot password link) to the login page if the user is not logged in:
Redirect a specific page to the login page:
- The function automatically applies a redirect back to the requested page. You only need to pass a redirect_to argument in the function if you want to redirect to a URL that is not the requested URL.
- This function can be helpful in situations where you may have something to block that is not handled the same way as ordinary content. Some examples would be custom post types that display content outside of the main $content variable (such as event calendars, forums, etc).
- Introduced in version 3.0.2
- Moved to API in 3.1.1
- Added redirect_to argument in 3.1.3
wpmem_redirect_to_login() is located in /inc/api.php.