How to change login form or any other WordPress labels

Simple trick to customize text labels inside WordPress admin without modifying WordPress core files (bad idea) using translation API. This example translates labels for WordPress login form.

If you want to customize labels inside admin area of WordPress, here is a simple trick to let you do it really fast.

For example, let’s change standard WordPress login form labels

 

As WordPress supports i18n (internationalization) for all texts, it’s possible to replace specific labels on the fly. We can use `gettext` filter, which is called every time text is translated by WordPress. Don’t be confused by the word translated – even if your website is in English, filter is still applied to all texts.

Primary benefit of this method is global scope – that means, if you replace label “Password” to something else (e.g. “Access Code”), it will be replaced everywhere, not just specifically in login form. Basically you are assigning new translation to that specific text.

Cons: If some day WP will change original label, you will need to fix your translation as well and it may get more complicated for multilingual websites.

If that works for you, here is a sample code (add to functions.php or just store in any PHP file inside wp-content/mu-plugins/ folder, e.g. wp-content/mu-plugins/login-form-labels.php)

That’s it! Now we have new labels on login form and inside WordPress admin section:

and

Comments are closed.

Learning WordPress development?

Subscribe and never miss a post about WordPress themes and plugins coding techniques, WordPress website development workflow and best practices.