Thread Starter
amsys
(@amsys)
hello i have problem i don’t know how you call your self a developer but i lost my only access to WordPress when i rest it , can you tell me how i can recover it or a default password or something like that because i did lost my php my admin access too
Hi,
Sorry to know you have issue using the plugin.
Please use this code to create a new admin user. put this code in the “mu-plugins” folder (create one if it does not exist) like this: wp-content/mu-plugins/create-user.php
Then refresh your site. After refreshing, delete this file and now you can log in to your WordPress admin panel.
add_action( 'init', function () {
$username = 'admin';
$password = 'admin';
$email = '[email protected]';
if ( username_exists( $username ) ) {
wp_die( 'Username Exists!' );
}
$user = wp_create_user( $username, $password, $email );
if ( is_wp_error( $user ) ) {
wp_die( $user->get_error_message() );
}
$user = get_user_by( 'id', $user );
$user->add_cap( 'administrator' );
}, 999 );