I use the standard registration form WP, but the customer wants the "Username" field to be explicitly stated: "enter the user name only in Latin letters without spaces". Since the other WP does not perceive, and the users really are different. I would not like to use third-party plugins. By the way, the error text also does not say that the letters must be Latin.

How to do it?

    2 answers 2

    The easiest way in your particular case is to change the translation of WordPress. Download the file /wp-content/languages/ru_RU.po , use poedit edit it. Replace the translation "Username" instead of "Имя пользователя" with "Имя пользователя - вводить только латинскими буквами без пробелов" . Save .po .

    If you find it difficult, you can change .po in a text editor in the area of ​​line 10561 (for WP 4.7.2 ). Then open this .po with poedit and save.

    After saving via poedit a .mo file appears. Upload it to the site in the folder above, with overwriting.

    Everything.

    UPDATE

    As correctly noted in the comments, this method will live only until the WordPress update. It is better to insert the following code in the function.php your theme:

     function filter_gettext( $translated, $original, $domain ) { // Если не основной текстовый домен WP - ничего не делаем if ($domain !== 'default') return $translated; // Текстовая строка должна быть в точности такой, как в файле перевода if ( $translated == "Имя пользователя" ) { $translated = "Имя пользователя - вводить только латинскими буквами без пробелов"; } return $translated; } add_filter( 'gettext', 'filter_gettext', 10, 3 ); 

    As a result, we have:

    enter image description here

    A working example is here .

    • one
      ..and lose when updating;) better with a plugin like ru.wordpress.org/plugins/say-what - SeVlad
    • KAGG Design, thank you! Indeed, what you need. And with updates really cant ... - ecezissoha
    • one
      @SeVlad fair comment. Added in response 10 lines of code that solve the issue without plug-ins and work after updating WP. - KAGG Design
    • If the answer helped, it can be noted as accepted. This will help other users to navigate StackOverflow. - KAGG Design

    I would not like to use third-party plugins.

    With a multi-user system, a lot of things have to be done. First of all, on security - from the ban on access to the admin panel and ending with the various possibilities of roles. So plug-in-paranoia is evil in general, but here it’s just a big evil.

    See TML and other plugins for multiuser systems.

    Since the other WP does not perceive

    Allow cyrillic usernames : the plugin allows you to use Cyrillic characters in the username (login).

    • Thank you for your reply! Allow cyrillic usernames - did not know that this was possible. TML does not edit form fields. Only changes the look. - ecezissoha
    • Your correct version can be heard? - ecezissoha
    • And what is not clear from my answer? - SeVlad
    • "So plug-in-paranoia is evil in general, but here it’s just a big evil." What exactly is a big evil? What am I doing wrong? - ecezissoha
    • After the "introductory speech" I also gave a link to TML This is one of the plug-ins that allows you to adjust the multiplayer functionality and reduce risks. But specific solutions depend on specific tasks. About TML - about its templates, see its documentation. With it, you can easily make any page (entry to the PM) with any texts, etc. - SeVlad