Redirections
in package
Login-related redirections.
- Redirect on successful login.
- Redirect to login if unauthenticated access to private page or post.
Tags
Table of Contents
Properties
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $settings : Settings
- The instance of the Settings class.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- login_redirect() : string
- Redirect user after successful login.
- redirect_private_to_login() : void
- Require login if attempting to access a private page or post.
- __construct() : void
- Initialise the class.
Properties
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$settings
The instance of the Settings class.
protected
Settings
$settings
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
login_redirect()
Redirect user after successful login.
public
login_redirect(string $redirect_to, string $requested_redirect_to, WP_User|WP_Error $user) : string
- If set, users go to requested redirect target.
- Administrators alwaysgo to backend admin page.
- Users go to member page.
Parameters
- $redirect_to : string
-
The redirect destination URL.
- $requested_redirect_to : string
-
The requested redirect destination URL passed as a parameter.
- $user : WP_User|WP_Error
-
Logged in user's data, or WP_Error if not set yet.
Tags
Return values
string —The url to redirect to.
redirect_private_to_login()
Require login if attempting to access a private page or post.
public
redirect_private_to_login() : void
- Return to originally requested page or post after succesful login.
Tags
__construct()
Initialise the class.
protected
__construct() : void