login_redirect
Filters the login redirect URL.
Usage
add_filter( 'login_redirect', 'wp_kama_login_redirect_filter', 10, 3 ); /** * Function for `login_redirect` filter-hook. * * @param string $redirect_to The redirect destination URL. * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. * * @return string */ function wp_kama_login_redirect_filter( $redirect_to, $requested_redirect_to, $user ){ // filter... return $redirect_to; }
- $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.
Changelog
Since 3.0.0 | Introduced. |
Where the hook is called
In file: /wp-login.php
login_redirect
wp-login.php 1359
$redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );