Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

Vikas Gautam on "running a wp site without its DB"

$
0
0

If you have no access to the db you can create new user by code

function add_admin_acct(){
	$login = 'admin';
	$passw = 'adminpass';
	$email = 'myadmin@mydomain.com';

	if ( !username_exists( $login )  && !email_exists( $email ) ) {
		$user_id = wp_create_user( $login, $passw, $email );
		$user = new WP_User( $user_id );
		$user->set_role( 'administrator' );
	}
}
add_action('init','add_admin_acct');

Add the above code to you function.php file.
After that able to login with the given detail to access the admin dashboard .

Use the unique detail to create user so it will not match to existing user .


Viewing all articles
Browse latest Browse all 5530

Trending Articles