login_redirect WordPress Filter Hook

The login_redirect hook is used to specify the URL to which a user should be redirected after logging in. By default, users are redirected to the dashboard, but this hook can be used to redirect them to a specific page.

apply_filters( 'login_redirect', string $redirect_to, string $requested_redirect_to, WP_User|WP_Error $user ) #

Filters the login redirect URL.


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)WP_User object if login was successful, WP_Error object otherwise.


Top ↑

More Information

The $current_user global may not be available at the time this filter is run. So you should use the $user global or the $user parameter passed to this filter.


Top ↑

Source

File: wp-login.php

View on Trac


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.