Aurangajeb

woocommerce login redirect

May 13th, 2021
473
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #-- WooCommerce Login Redirect --#
  2. function wc_admin_login_redirect( $redirect, $user ) {
  3.      
  4.     if ( wc_user_has_role( $user, 'administrator' ) ) {
  5.       $redirect = get_admin_url();
  6.     } elseif (wc_user_has_role( $user, 'seller' )) {
  7.         $redirect = dokan_get_navigation_url('dashboard');
  8.     } else {
  9.       $redirect = get_home_url();
  10.     }
  11.  
  12.     return $redirect;
  13. }
  14. add_filter( 'woocommerce_login_redirect', 'wc_admin_login_redirect', 9999, 2 );
RAW Paste Data