How to create an admin account by FTP?

How can I create an admin access when I only have FTP access?

Add this code to your functions file:

<?php
function wpster_add_admin_account(){
$user = 'username';
$pass = 'pass';
$email = 'email@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
add_action('init','wpster_add_admin_account');
?>

Submit a Comment

Your email address will not be published. Required fields are marked *