Home>

WordPress member site plug-in "WP-Members" registration form
I want to display a placeholder "alphanumeric characters" in place of "user name".

Warning: Use of undefined constant field-assumed 'field' (this will throw an Error in a future version of PHP) in/site URL/functions.php on line 583
Applicable source code
add_filter ('wpmem_register_form_rows', 'my_register_form_rows_filter', 10, 2);
function my_register_form_rows_filter ($rows, $toggle) {
    $rows ['username'] [field] = '<input name = "log" type = "text" value = "" placeholder = "alphanumeric characters">';
    return $rows;
}
Sites you ’ve tried/referenced

I wrote the above code at the bottom of functions.php.
This site is helpful
https://moca-d.com/1177.html
Is it wrong to write functions.php?
Is there an error in the explanation of the above site?

I am in trouble because I cannot make my own judgment.

※ By the way, the 583rd line which is a problem is
$rows ['username'] [field] = '';

Supplemental information (FW/tool version etc.)

Theme used: lightning pro

  • Answer # 1

    Is it just right to fix the error?

    $rows ['username'] [field]

    $rows ['username'] ['field']

    Please be aware that it is different whether the expected operation can be achieved.