Redirect after vendor manager login

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM Redirect after vendor manager login

Viewing 1 reply thread
  • Author
    Posts
    • #129733
      dev.laditum
      Participant

      When a vendor manager logs in they are redirected to the WCFM page. Can I stop them from being redirected when on certain pages? I do not want them to be redirected when on a Woocommerce single product page.

    • #129943

      Hello,

      Add this code to your child theme’s functions.php

      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      add_filter('wcfm_login_redirect','fn_wcfm_login_redirect_1205',10,2);
      function fn_wcfm_login_redirect_1205($redirect_to, $user) {
      	if ( isset($user->roles) && is_array($user->roles) ) {
      			if ( in_array( 'vendor', $user->roles ) ) {
      				$redirect_to = '<your product page url>';
      			} elseif ( in_array( 'seller', $user->roles ) ) {
      				$redirect_to = '<your product page url>';
      			} elseif ( in_array( 'wcfm_vendor', $user->roles ) ) {
      				$redirect_to = '<your product page url>';
      			} elseif ( in_array( 'dc_vendor', $user->roles ) ) {
      				$redirect_to = '<your product page url>';
      			} 
      		}
      	return $redirect_to;
      }

      Thanks.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.