How autocorrect username type in wp mu registration ?

in wp username can only lowercase and no space or symbol

my market usually don’t know and use space and or symbol to their username registration

is there any solution that make auto correct for their input

example :

1. when they type “my username” then automatically became “myusername”

2. when they type “my.username” then automatically became “myusername”

or any idea in this issue?

  • Sajid
    • DEV MAN’s Sidekick

    Hi @Dwi

    Hope you are doing good today :slight_smile:

    Add following code in footer.php file of your child theme. If you don’t have a child theme yet then you can create one by following simple steps in this article.

    https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/

    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $("#user_name").on("blur", function() {
    $(this).val($(this).val().replace(/[. ,:-]+/g, ""));
    });
    });
    </script>

    This code will remove all empty spaces and not allowed characters from username field.

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.