Languages: English • Italiano • 日本語 (Add your language)
Checks user is logged in, if not it redirects them to login page.
When this code is called from a page, it checks to see if the user viewing the page is logged in. If the user is not logged in, they are redirected to the login page. The user is redirected in such a way that, upon logging in, they will be sent directly to the page they were originally trying to access.
<?php auth_redirect(); ?>
This function accepts no parameters.
Function redirects or exits, does not return
Require a user to log in in order to view a page:
if ( !is_user_logged_in() ) { auth_redirect(); }
As a pluggable function, you can redefine it and your version will be used instead.
Since: 1.5
auth_redirect() is located in wp-includes/pluggable.php