pfeifferNet

Redirections
in package

Login-related redirections.

  • Redirect on successful login.
  • Redirect to login if unauthenticated access to private page or post.
Tags
since
5.11.0

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
since
5.11.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
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
since
1.0.0
since
6.0.0

Moved from class-login.

link
https://developer.wordpress.org/reference/hooks/login_redirect/
uses
Settings::get()
Return values
string

The url to redirect to.

__construct()

Initialise the class.

protected __construct() : void
Tags
since
5.11.0
since
6.3.0

Use the Settings class.

uses
Settings

        
On this page

Search results