Skip to content

Instantly share code, notes, and snippets.

@antcms
Last active July 12, 2016 10:05
Show Gist options
  • Save antcms/1660f12228983f7d8f16cd2576564f07 to your computer and use it in GitHub Desktop.
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'.
//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