Lost user access | WordPress.org

[ad_1]

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

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 );

Then refresh your site. After refreshing, delete this file and now you can log in to your WordPress admin panel using “admin” as username and “admin” as password.

Best regards,
Younes

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer