Placeholder text for registration form

Another simple way to do this without needing to add another script is using PHP’s str_replace function.

$args = array(
    'echo' => false,
);

$form = wp_login_form( $args ); 

//add the placeholders
$form = str_replace('name="log"', 'name="log" placeholder="Username"', $form);
$form = str_replace('name="pwd"', 'name="pwd" placeholder="Password"', $form);

echo $form;

Leave a Comment