WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/auth redirect

Contents

Description

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.

Usage

<?php auth_redirect(); ?>

Parameters

This function accepts no parameters.

Return Values

Function redirects or exits, does not return

Examples

Notes

As a pluggable function, you can redefine it and your version will be used instead.

Change Log

Since: 1.5

Source File

auth_redirect() is located in wp-includes/pluggable.php

Related

is_user_logged_in(), wp_redirect()

See also index of Function Reference and index of Template Tags.