Change where the Divi Login Module Redirects To

Divi Includes a Login Module, which lets you add a login box to any page / Divi Builder layout. If you need to control where the user ends up after login in, here are some options:

Redirecting Back to the Current Page

The Divi Login Module includes a built-in option for redirecting the user back to the current page. To use it, enable the option at:

Login Settings > Content > Redirect > Redirect To The Current Page

Redirecting to the Dashboard / User Profile

The default behavior of the Divi Login Module is to redirect the user to either the dashboard or their user profile, depending on the Role set in their profile. To use this behavior, ensure that the option for redirecting the user back to the current page is disabled. You can disable the option (the default) at:

Login Settings > Content > Redirect > Redirect To The Current Page

The option will redirect users as follows:

  • Subscriber – User profile page
  • Contributor – Dashboard
  • Author – Dashboard
  • Editor – Dashboard
  • Admin – Dashboard

Redirect to a Custom URL with Divi Booster

Divi Booster adds an option to redirect the user to a custom page upon login. You can activate it by setting:

Login Settings > Content > Redirect > Redirect To The Current Page = No

Then adding your custom URL at:

Login Settings > Content > Redirect > Custom Redirect URL

After saving the login module settings, your users should be redirected to the custom URL upon login.

This option is available in Divi Booster 3.9.9 upwards.

Redirect to a Custom URL with PHP

You can redirect your login modules to a custom page on log in using this PHP code:

add_filter('et_pb_login_shortcode_output', 'dbc_set_custom_login_redirect');

function dbc_set_custom_login_redirect($output) {
    if (is_user_logged_in()) { return $output; }
    $redirect_to = 'https://localhost/welcome-page';
    $output = preg_replace('/<input type="hidden" name="redirect_to"[^>]*>/s', '', $output);
    $output = str_replace('</form>', '<input type="hidden" name="redirect_to" value="'.esc_attr($redirect_to).'"/></form>', $output);
    return $output;

Simply replace 'https://localhost/welcome-page' in the code above with the URL you'd like to redirect to.


  1. Hi. I use the login module on product template on a B2B site, clients must login in to see prices.
    I would like the module not to redirect at all after login, I want the client to remain on that product page. Is this possible?

    • Hi Johan,

      You should be able to achieve that by enabling the following setting in the login module settings:

      Login Settings > Content > Redirect > Redirect To The Current Page

      It returns the user to the current page, meaning they should end up back on the same page they started, i.e. your product page.

      If that doesn't work for you for any reason, let me know. Thanks!

      • Sorry, but that does not work. Thanks anyway. Btw, ET support said the same thing.
        Will search all added code to this site, there is something that is over-riding things.

        • Hey Johan, sorry that didn't do it. If you are able to share a link to the page with the login I'll be happy to take a look and see if I can spot anything that might be causing it. If you haven't already, it might be worth also clearing any caches in use on the site in case an old version of the page / login module is being displayed…

  2. Hi Dan thank you for this guide, for some reason the php code you gave doesnt work anymore?

    • Hey Steve, sorry it hasn't been working for you. I've just checked on my test site and the code still seems to be working correctly there (with the latest Divi). Is there any chance you're able to share a link to the page you're working on so that I can take a look at what's going on? Thanks!

  3. Hello!
    Is a way to redirect to any specific page (I mean, not to the currente page, neither to the dashboard).

    • Hey René, I've just added a section on how to redirect to a specific page using PHP. I'm also adding an option to set a custom redirect URL to the login module in the next version of Divi Booster (v3.9.9). I should be able to release that update in the next few days and will update the post with details when it's available. I hope that helps! Dan

      • Hey René, I've now released the update and have added a section on the feature to the post above. Thanks!


Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

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

We may earn a commission when you visit links on our website.