Description
Filter hook to redirect the user upon login.
Parameters
$redirect_to
(string)(required) The URL to redirect the user to.
$user_id
(integer)(optional) The user’s primary key ID.
Usage
add_filter( 'wpmem_login_redirect', 'my_login_redirect', 10, 2 ); function my_login_redirect( $redirect_to, $user_id ) { // This will redirect to https://yourdomain.com/your-page/ return home_url( '/your-page/' ); }
Notes
In plugin version 3.1.7, the WordPress login_redirect hook was added to login function. A filter for login_redirect would run on all logins across the site (whether from the WP-Members form or any other login form). A filter for wpmem_login_redirect would run only from the WP-Members login forms.
In order of operations, the login_redirect filter is applied first, then wpmem_login_redirect.
Changelog
- Introduced in 2.7.7
- $user_id argument added in 2.9.2
- login_redirect added to login function in 3.1.7
Source
wpmem_login_redirect is located in includes/class-wp-members-user.php