[NSFW] i have lost my access to wordpress

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    = 'admin@dev.io';

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

 

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.

Your Advertisement Here