Filter
rpress_login_redirect
On this page
Filters the URL a customer is redirected to after a successful login.
Runs in rpress_process_login_form after the credentials were accepted and no errors remain. The default is the redirect value submitted with the form. The result is passed to wp_safe_redirect, so it must point to the site or to a host allowed by allowed_redirect_hosts.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$redirect | string | The redirect URL submitted with the login form. |
$user_ID | int | ID of the user who logged in. |
Return value#
string. The URL to redirect to.
Example#
function my_login_redirect( $redirect, $user_ID ) {
if ( user_can( $user_ID, 'manage_options' ) ) {
return admin_url();
}
return $redirect;
}
add_filter( 'rpress_login_redirect', 'my_login_redirect', 10, 2 );
Source#
Applied in:
includes/login-register.php(line 81), inrpress_process_login_form()
See also#
Was this page helpful?
