Posted on

Change the password strength meter labels

Change the password strength meter labels

A while ago I wrote a post about how to remove the password strength meter from the Checkout page. Since I strongly encourage you to not remove it though, like mentioned in that article as well, just changing the meter labels to something easier to understand can help instead!

By changing the meter labels you can explain what could be wrong with the password used, even if that would be hard since the script uses a 3rd-party tool to check the strength of a password which does not only check its length, presence of specific characters, numbers or signs.

You can read more about how it works on WP Tavern.

Probably you already understood that the password strength meter script is not from WooCommerce, so we have to change the meter labels in WordPress directly.

There’s a way to do it, you need to re-localize the script in your theme.
Since the theme is loaded after the core of WordPress, the new localization will load after the one in the core, and this last one will be used instead.

Open your functions.php file located in wp-content/themes/your-child-theme-name/ and add this code at the end of it:

Now these new meter labels will be used instead of the core meter labels. They will be used everywhere the password strength meter is used, so in the edit user screen in the Dashboard, in the My Account page if the registration form is enabled and on the checkout page as well.

Update 23rd Feb. 2016: You can change also the default messages returned by WooCommerce. To do so, use this code:

5 thoughts on “Change the password strength meter labels

  1. […] Mustone posted a tutorial on changing the WordPress password strength meter messages, which is helpful for WooCommerce […]

  2. This is great, thank you!

    1. You’re welcome Derek!

  3. Is it possible to adjust the actual strength requirements, e.g. the number of required characters, whether numerals/special characters are needed? – I’ve been having customers that are battling the strength meter. It was costing sales so I temporarily disabled it… But I don’t want it removed for the long term.

  4. Sir, the above code is gor what because the previous code is well it removes the strong validation but doesn’t suggest to keep strong password. If the above code purpose is to show alert messages to keep strong password with the previous code then it doesn’t work at all.
    So please tell how to add recommendation message for user to keep strong password with previous snippets

Leave a Reply

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