Last active
July 12, 2016 10:05
-
-
Save antcms/1660f12228983f7d8f16cd2576564f07 to your computer and use it in GitHub Desktop.
Logout redirect for front-end users in WordPress, in this case Authors with access to the back end to add posts. Redirects to a front end page called 'Members Home'.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//AUTHOR LOGOUT | |
add_filter( 'logout_url', 'author_logout_page', 10, 2 ); | |
function author_logout_page( $logout_url, $redirect ) { | |
$user = wp_get_current_user(); | |
if ( in_array( 'author', (array) $user->roles ) ) { | |
return home_url( '/members-home/' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment