Skip to content
Docs
Get RestroPress

Filter

rpress_login_redirect

Updated
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#

ParameterTypeDescription
$redirectstringThe redirect URL submitted with the login form.
$user_IDintID 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), in rpress_process_login_form()

See also#

Was this page helpful?