Created
May 27, 2016 19:36
-
-
Save bentasm1/a2c57c7b633d7dbc4a39043aa31a9f59 to your computer and use it in GitHub Desktop.
WC Vendors - Redirect even from wp-login.php for the role vendor
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
/* WC Vendors - Redirect even from wp-login.php for the role vendor */ | |
add_action( 'admin_init', 'wcvendors_wplogin_redirect' ); | |
function wcvendors_wplogin_redirect() { | |
if ( ! defined( 'DOING_AJAX' ) ) { | |
$current_user = wp_get_current_user(); | |
$role_name = $current_user->roles[0]; | |
if ( 'vendor' === $role_name ) { | |
wp_redirect( 'http://yoursite.com/dashboard' ); | |
} // if $role_name | |
} // if DOING_AJAX | |
} // wcvendors_wplogin_redirect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment