Skip to content

Instantly share code, notes, and snippets.

@stephanieleary
Created October 17, 2016 14:58
Show Gist options
  • Save stephanieleary/9b4b2c4b5f512660204f20af5915ee6f to your computer and use it in GitHub Desktop.
Save stephanieleary/9b4b2c4b5f512660204f20af5915ee6f to your computer and use it in GitHub Desktop.
Redirect to top-level dashboard (instead of profile) if not superadmin or not allowed on this blog
<?php
add_filter( 'login_redirect', 'scl_network_dashboard_login_redirect', 100, 3 );
function scl_network_dashboard_login_redirect( $redirect_to, $request_redirect_to, $user ) {
if ( !is_user_member_of_blog() || ( is_main_site() && !is_super_admin() ) )
return network_admin_url();
return $redirect_to;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment