Is there an easy way to add a required symbol like '*' after the html <label> text content in the default user registration form?

I'd like the Username and E-mail labels to display: Username * and Email *

I've tried using CSS, as in:

#registerform p label::after { content:" *"; color: red; }

But the asterisk appears under the text field, not beside the text.

I checked the Codex but couldn't find a WP filter, so does this mean I need to create an entirely custom registration form?

1 Answer 1


The * appears under the field because the field is inside the label. There doesn't appear to be any useful filters for this, but you could use one of the hooks to inject some JS on the page that adds the *:

required = jQuery( "<span>*</span>" );
required.css("color", "red");
jQuery('label br').before( required );

Note: if you're going to use a library like jQuery in my example, you'll need to queue that as well - it's not by default on the register page

  • Thanks! That works really well. Only issue - it applies to every field and I have some custom non-required. Is it possible to target with something like this: jQuery( 'label[for="user_login"] br').before( required ); jQuery( 'label[for="user_email"] br').before( required ); Commented Jan 16, 2015 at 21:55
  • In the above, only the second one will work. But if you remove it, the first one will work. Commented Jan 16, 2015 at 21:56
  • 1
    I put the labels in an array ( var the_labels = ["user_login", "user_email", "first_name", "last_name"]; ) and looped through it with for creating a unique "required" for each label ( so required1, required2, etc.) That did it. Thanks, @karpstrucking Commented Jan 16, 2015 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.