WordPress.org

Ready to get started?Download WordPress

Forums

How to hard code a specific user on wp-login? (3 posts)

  1. JasonAG77
    Member
    Posted 4 years ago #

    Hi everyone,

    I've set up several blogs, but this is quite an interesting puzzle I'm encountering, and I don't know how to figure it out, as I'm weak at PHP...

    My fiance and I are setting up our wedding website, and it's all run by WordPress. Only one page can be seen when you arrive on the site; all other links require typing the password that we've provided to our guests via "save the date" cards. We've set up a username of "guest" for visitors, but we don't want to have them type "guest" in the username field. It should be as little work for them as possible (only entering the password, and hitting submit). Thus, is there a way I can hardcode the "guest" username in wp-login.php? My fiance and I are already logging in through a different login page so that we can modify wp-login.php, but I don't know how to modify the code such that the value "guest" will be passed when a user hits the submit button.

    Any and all help is appreciated. Thanks!

  2. lokrin2000
    Member
    Posted 4 years ago #

    Look in wp-login.php in your home directory.

    Find:

    <label><?php _e('Username or E-mail:') ?><br />
    		<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>

    Change:
    value="<?php echo esc_attr($user_login); ?>"

    Tp:
    value="guest"

    That might work...

  3. JasonAG77
    Member
    Posted 4 years ago #

    That did it! Actually, I went one step further and made an input type="hidden" so users won't even see anything other than the password field.

    Thanks for pointing me in the right direction!

Topic Closed

This topic has been closed to new replies.

About this Topic