Disable Redirect to Dashboard on Login

This snippet will disable the automatic redirect to the Vendor Dashboard when a vendor logs into the My Account page form. On my site, I decided to have links to “Vendor Login” and “Customer Login” in my top bar menu. Then on the Vendor Dashboard page, I hid the registration form with CSS so it only shows a login form when not logged in. If a vendor logged in to the regular My Account page, I wanted them going to their account. Many of my vendors are also customers.

As always, this is either added to your Child Theme’s functions.php file, or consider using the My Custom Functions Pro plugin to manage and organize all your snippets.

add_action('init','wcmp_init');

function wcmp_init(){
   global $WCMp;
   remove_filter('woocommerce_registration_redirect', array($WCMp->user, 'vendor_login_redirect'), 30);
   remove_filter('woocommerce_login_redirect', array($WCMp->user, 'wcmp_vendor_login'), 10);
   remove_filter('login_redirect', array($WCMp->user, 'wp_wcmp_vendor_login'), 10);
}

Comments on this post

Your email address will not be published. Required fields are marked *