Filters the log out redirect URL.
Parameters
Source
$redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user );
Changelog
Version | Description |
---|---|
4.2.0 | Introduced. |
Filters the log out redirect URL.
$redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user );
Version | Description |
---|---|
4.2.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Logout function (that actually works) according user role:
taken from the article at sourcexpress.com/logout_redirect-filter-hook-introduced-in-wordpress-4-2
This filter comes with 3 parameters,
string $redirect_to
The redirect destination URL,string $requested_redirect_to
The requested redirect destination URL passed as parameter,WP_User $user
WP_User object for the user logging out.Using the third param we can target specific redirect locations depending on the user, user role etc.