Website Building » WooCommerce » How Do I Change My WooCommerce Login URL?

How Do I Change My WooCommerce Login URL?

Last updated on January 23, 2023 @ 12:05 pm

When it comes to setting up an online store, WooCommerce is one of the most popular choices for WordPress users. While it’s a fairly straightforward platform to use, there are still a few things that can trip up new users. One of those things is changing the default login URL.

The default login URL for WooCommerce is /my-account/. This is fine if you don’t have anything else going on with your website that would require a /my-account/ URL. However, if you do have something else using that URL (like a membership site), then you’ll need to change the WooCommerce login URL to avoid any conflicts.

Changing the WooCommerce login URL is actually pretty easy to do.

There are two methods you can use:

  • Change it via the WordPress admin dashboard
  • Change it via your theme’s functions.php file

We’ll walk you through both methods so you can choose the one that’s best for you.

Method 1: Change the Login URL Via the WordPress Admin Dashboard

This method is best for those who are comfortable working with code and don’t mind doing a little bit of research. We’ll be using the WordPress Rewrite API to add a new rewrite rule that will change the WooCommerce login URL.

First, you need to connect to your WordPress site via FTP and edit your theme’s functions.php file.

PRO TIP: If you are considering changing your WooCommerce login URL, be aware that this can potentially cause problems with your website. Depending on how your website is configured, changing your login URL may result in lost data or decreased functionality. If you are unsure about how to change your login URL, it is best to consult with a WooCommerce expert before proceeding.

Once you have access to your functions.php file, add this code snippet:

function wc_change_login_url() {
    add_rewrite_rule(
        '^my-account$',
        'index.php?wc_login=true',
        'top'
    );
}
add_action( 'init', 'wc_change_login_url' );

Make sure to save your changes and upload the file back to your server. Once that’s done, head back over to your WordPress admin area and go to Settings » Permalinks and click on the Save Changes button.

This will flush the rewrite rules and update your .htaccess file with the new rewrite rule we just added in functions.php.

Method 2: Change the Login URL Via Your Theme’s Functions.php File

If you’re not comfortable working with code or don’t want to mess with any of the under-the-hood settings in WordPress, then this method is for you.

All you need to do is add this one line of code to your theme’s functions.php file:

define( 'WC_LOGIN_URL', home_url() );

Be sure to save your changes and upload the file back to your server..

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.