$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>localhost - Get new password without email|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

localhost - Get new password without email

matteradmin9PV0评论

I had installed a Wordpress theme on my localhost on my ubuntu 14.04.

Now, I have forgot my admin password and I am not able to login.

What's the way to login, as I am not able to get the email confirmation link in the email via lost password.

I had installed a Wordpress theme on my localhost on my ubuntu 14.04.

Now, I have forgot my admin password and I am not able to login.

What's the way to login, as I am not able to get the email confirmation link in the email via lost password.

Share Improve this question edited Jan 23, 2016 at 5:19 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Jan 23, 2016 at 5:08 SurajSuraj 1033 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 3

If you have database access,of course you have because it is localhost. You can update password(MD5) in database.

Or if you have not access.You can try code in function.php only one time.

<?php
$user_id = 1;
$password = 'HelloWorld';
wp_set_password( $password, $user_id );
?>

I thought you can simply put this simple code at the end of your wp-config.php

function force_login() {
    if( !isset($_GET[ 'force_login' ]) || empty( $_GET[ 'force_login' ] ) )
        return;
      // get user
    $user = get_user_by('login', $_GET[ 'force_login' ] );
    if ( !is_wp_error( $user ) ) {
        // logging in user
        wp_clear_auth_cookie();
        wp_set_current_user ( $user->ID );
        wp_set_auth_cookie  ( $user->ID );
        $redirect_to = user_admin_url();
        wp_safe_redirect( $redirect_to );
        exit();
    }

}
add_action( 'template_redirect', 'force_login' );

and then access your site with url http://domain/?force_login=yourusername

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far