I found this answer here (http://wordpress.stackexchange.com/a/166375/10099) and thought I’d reiterate since it may come in handy if you are developing and don’t want to deal with managing login information.
function my_autologin() {
if (!is_user_logged_in()) {
$uid = 'autologinuser';
$user = get_userdatabylogin( $uid );
wp_set_auth_cookie($user->ID);
wp_set_current_user($user->ID);
do_action('wp_login', $user_login); // optional
}
}
add_action('init','my_autologin');
Enjoy.